CourseWork/app/Services/LessonService.php
2024-05-08 12:59:29 +04:00

34 lines
586 B
PHP

<?php
namespace App\Services;
use App\Models\Lesson;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
class LessonService implements ServiceInterface
{
public function getAll(): Collection
{
return Lesson::all();
}
public function create(array $data): Lesson
{
return Lesson::create($data);
}
public function update(Model $model, array $data): Lesson
{
$model->update($data);
return $model;
}
public function delete($model): void
{
$model->delete();
}
}