123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Repositories\Eloquent\Info;
- use App\Contracts\Repositories\Info\NewsRepository;
- use App\Repositories\Criteria\Info\NewsCriteria;
- use App\Repositories\Models\Info\News;
- use Prettus\Repository\Criteria\RequestCriteria;
- use Prettus\Repository\Eloquent\BaseRepository;
- class NewsRepositoryEloquent extends BaseRepository implements NewsRepository
- {
- protected $fieldSearchable = [
- // 'name' => 'like', Default Condition "="
- ];
- /**
- * Specify Model class name.
- *
- * @return string
- */
- public function model()
- {
- return News::class;
- }
- /**
- * Boot up the repository, pushing criteria.
- *
- * @throws \Prettus\Repository\Exceptions\RepositoryException
- */
- public function boot()
- {
- $this->pushCriteria(app(RequestCriteria::class));
- }
- /**
- * @return mixed
- */
- public function searchNewssByPage()
- {
- return $this->paginate(request('per_page', 15));
- }
- /**
- * @param $id
- *
- * @return mixed
- */
- public function searchNewsBy($id)
- {
- return $this->find($id);
- }
- }
|