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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace App\Queries;
use App\Models\User;
class UserQuery {
private $query;
public function __construct()
{
$this->query = User::where([]);
}
/**
* @param integer $id
* @return UserQuery|Builder
*/
public function whereId($id, $expression = '=')
{
$this->query = $this->query->where('id', $expression, $id);
return $this->query;
}
/**
* @param integer $type
* @return UserQuery|Builder
*/
public function whereType($type, $expression = '=')
{
$this->query = $this->query->where('type', $expression, $type);
return $this->query;
}
/**
* @return Builder
*/
public function getQuery()
{
return $this->query;
}
}