CourseWork/app/Services/GradeService.php

34 lines
628 B
PHP
Raw Normal View History

2024-04-23 14:52:49 +04:00
<?php
namespace App\Services;
use App\Models\Grade;
2024-05-06 17:47:25 +04:00
use Illuminate\Database\Eloquent\Model;
2024-04-23 14:52:49 +04:00
use Illuminate\Pagination\LengthAwarePaginator;
class GradeService implements ServiceInterface
{
public function getAll(): LengthAwarePaginator
{
2024-05-06 17:47:25 +04:00
return Grade::filter()->paginate(5)->withQueryString();
2024-04-23 14:52:49 +04:00
}
public function create(array $data): Grade
{
return Grade::create($data);
}
2024-05-06 17:47:25 +04:00
public function update(Model $model, array $data): Grade
2024-04-23 14:52:49 +04:00
{
$model->update($data);
return $model;
}
public function delete($model): void
{
$model->delete();
}
}