123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- /**
- * 通话列表
- * @author system
- * @version 1.0
- * @date 2018-12-18 16:38:51
- *
- */
- namespace App\Repositories\Call;
- use App\Repositories\Base\Repository;
- class ListRepository extends Repository {
- public function model() {
- return \App\Models\CallListModel::class;
- }
- public function searchList(array $search, array $orderby = ['id' => 'desc'])
- {
- $currentQuery = $this->model;
- if (isset($search['keyword']) && !empty($search['keyword'])) {
- $keywords = '%'.$search['keyword'].'%';
- $currentQuery = $currentQuery->where(function ($query) use ($keywords) {
- $query->where('ip','like', $keywords)->orWhere('phone','like', $keywords);
- });
- };
- if ($orderby && is_array($orderby)) {
- foreach ($orderby AS $field => $value) {
- $currentQuery = $currentQuery->orderBy($field, $value);
- }
- };
- return $currentQuery;
- }
-
- }
|