123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Repositories;
- use App\Models\Link;
- use Prettus\Repository\Eloquent\BaseRepository;
- class LinkRepository extends BaseRepository
- {
-
- public function model()
- {
- return Link::class;
- }
- public function getLinks($where, $limit = '')
- {
-
- $res = $this->model->whereHas('subsites', function ($query) {
- $query->where('subsite_id', get_subsite_id());
- })->where($where)->orderBy('list_order', 'desc')->orderBy('created_at', 'desc');
- if ($limit) {
- $res->limit($limit);
- }
- return $res->get();
- }
- }
|