33 lines
595 B
PHP
33 lines
595 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Services;
|
||
|
|
||
|
use App\Models\Subject;
|
||
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||
|
|
||
|
class SubjectService implements ServiceInterface
|
||
|
{
|
||
|
|
||
|
public function getAll(): LengthAwarePaginator
|
||
|
{
|
||
|
return Subject::filter()->paginate(10)->withQueryString();
|
||
|
}
|
||
|
|
||
|
public function create(array $data): Subject
|
||
|
{
|
||
|
return Subject::create($data);
|
||
|
}
|
||
|
|
||
|
public function update($model, array $data): Subject
|
||
|
{
|
||
|
$model->update($data);
|
||
|
|
||
|
return $model;
|
||
|
}
|
||
|
|
||
|
public function delete($model): void
|
||
|
{
|
||
|
$model->delete();
|
||
|
}
|
||
|
}
|