CourseWork/app/Services/GradeService.php
2024-05-06 17:51:16 +04:00

33 lines
627 B
PHP

<?php
namespace App\Services;
use App\Models\Grade;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Pagination\LengthAwarePaginator;
class GradeService implements ServiceInterface
{
public function getAll(): LengthAwarePaginator
{
return Grade::filter()->paginate(5)->withQueryString();
}
public function create(array $data): Grade
{
return Grade::create($data);
}
public function update(Model $model, array $data): Grade
{
$model->update($data);
return $model;
}
public function delete($model): void
{
$model->delete();
}
}