22 lines
448 B
PHP
22 lines
448 B
PHP
<?php
|
|
|
|
namespace App\Actions\Course;
|
|
|
|
use App\Events\ModelChanged;
|
|
use App\Models\Course;
|
|
use App\Repositories\Contracts\CourseRepositoryInterface;
|
|
|
|
class DeleteCourseAction
|
|
{
|
|
public function __construct(private CourseRepositoryInterface $repository) {}
|
|
|
|
public function execute(Course $course): bool
|
|
{
|
|
$this->repository->delete($course);
|
|
|
|
ModelChanged::dispatch(Course::class, 'deleted');
|
|
|
|
return true;
|
|
}
|
|
}
|