34 lines
628 B
PHP
34 lines
628 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();
|
|
}
|
|
}
|