1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Repositories;
- abstract class ResourceRepository
- {
- protected $model;
- // public function getPaginate($n)
- // {
- // return $this->model->paginate($n);
- // }
- public function store(Array $inputs)
- {
- return $this->model->create($inputs);
- }
- public function getById($id)
- {
- return $this->model->findOrFail($id);
- }
- public function update($id, Array $inputs)
- {
- $this->getById($id)->fill($inputs)->save();
- }
- public function destroy($id)
- {
- $this->getById($id)->delete();
- }
- }
|