1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace App\Repositories\Eloquent\Course;
- use App\Repositories\Criteria\Course\CategoryCriteria;
- use App\Repositories\Criteria\RequestCriteria;
- use App\Repositories\Models\Course\Category;
- use Prettus\Repository\Eloquent\BaseRepository;
- use App\Contracts\Repositories\Course\ChapterRepository;
- /**
- * Class CourseChapterRepositoryEloquent.
- *
- * @package namespace App\Repositories\Eloquent;
- */
- class CategoryRepositoryEloquent extends BaseRepository implements ChapterRepository
- {
- protected $fieldSearchable = [
- // 'name' => 'like', Default Condition "="
- ];
- /**
- * Specify Model class name.
- *
- * @return string
- */
- public function model()
- {
- return Category::class;
- }
- /**
- * Boot up the repository, pushing criteria.
- *
- * @throws \Prettus\Repository\Exceptions\RepositoryException
- */
- public function boot()
- {
- $this->pushCriteria(app(RequestCriteria::class));
- }
- /**
- * @return mixed
- */
- public function searchCategoryByPage()
- {
- return $this->paginate(request('per_page', 15));
- }
- /**
- * @param $id
- *
- * @return mixed
- */
- public function searchCategoryBy($id)
- {
- return $this->find($id);
- }
- }
|