update deploy
This commit is contained in:
22
app/Actions/Schedule/UpdateScheduleAction.php
Normal file
22
app/Actions/Schedule/UpdateScheduleAction.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Schedule;
|
||||
|
||||
use App\DTOs\ScheduleData;
|
||||
use App\Events\ModelChanged;
|
||||
use App\Models\CourseSchedule;
|
||||
use App\Repositories\Contracts\ScheduleRepositoryInterface;
|
||||
|
||||
final class UpdateScheduleAction
|
||||
{
|
||||
public function __construct(private ScheduleRepositoryInterface $repository) {}
|
||||
|
||||
public function execute(CourseSchedule $schedule, ScheduleData $data): CourseSchedule
|
||||
{
|
||||
$result = $this->repository->update($schedule, $data->toArray());
|
||||
|
||||
ModelChanged::dispatch(CourseSchedule::class, 'updated');
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user