Files
wticreatorstudio/Modules/StudioPlus/Http/Controllers/API/WatermarkingJobsController.php
T
2024-02-12 22:54:20 -05:00

54 lines
1.3 KiB
PHP

<?php
namespace Modules\StudioPlus\Http\Controllers\API;
//use App\Events\TestEvent;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Modules\StudioPlus\Events\TestEvent;
use Modules\StudioPlus\Repositories\WatermarkingJobsRepository;
class WatermarkingJobsController extends Controller
{
protected $repository;
public function __construct()
{
$this->repository = new WatermarkingJobsRepository();
}
public function index()
{
return $this->repository->getCollection();
}
public function deleteCompleted()
{
$this->repository->deleteCompleted();
$jobs = $this->repository->getCollection();
return response()->json([
'message' => 'Completed jobs has been deleted from the queue.',
'jobs' => $jobs,
]);
}
public function delete(Request $request)
{
$this->repository->delete($request->input('id'));
$jobs = $this->repository->getCollection();
return response()->json([
'message' => 'Job has been deleted from the queue.',
'jobs' => $jobs,
]);
}
public function testEvent()
{
event(new TestEvent());
return 'testing';
}
}