Blame view

app/Filters/Auth/Users.php 571 Bytes
b7c7a5f6   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  <?php
  
  namespace App\Filters\Auth;
  
  use EloquentFilter\ModelFilter;
  
  class Users extends ModelFilter
  {
      /**
       * Related Models that have ModelFilters as well as the method on the ModelFilter
       * As [relatedModel => [input_key1, input_key2]].
       *
       * @var array
       */
      public $relations = [];
  
      public function search($query)
      {
          return $this->where('name', 'LIKE', '%' . $query . '%')->orWhere('email', 'LIKE', '%' . $query . '%');
      }
  
      public function role($id)
      {
          return $this->related('roles', 'role_id', $id);
      }
  }