12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Repositories;
- use App\Models\CategoryMajor;
- use Prettus\Repository\Eloquent\BaseRepository;
- use Prettus\Repository\Criteria\RequestCriteria;
- /**
- * Class MemberRepositoryEloquent.
- *
- * @package namespace App\Repositories;
- */
- class CategoryMajorRepository extends BaseRepository
- {
- /**
- * Specify Model class name
- *
- * @return string
- */
- public function model()
- {
- return CategoryMajor::class;
- }
- /**
- * Boot up the repository, pushing criteria
- */
- public function boot()
- {
- $this->pushCriteria(app(RequestCriteria::class));
- }
- /**
- * @param $id
- * @return mixed
- */
- public function getCategoryMajor($id)
- {
- return $this->model->find($id);
- }
- public function getCategoryById($parent = 0)
- {
- return $this->model->where(['parent_id'=>$parent])->select(['id','name','parent_id'])->get()->toArray();
- }
- public function getMajorList()
- {
- return $this->model->select(['id','name','parent_id'])->get()->toArray();
- }
- }
|