Total Complexity | 3 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class RandomModelAttributeQuery extends Query |
||
9 | { |
||
10 | /** |
||
11 | * @var Model|string |
||
12 | */ |
||
13 | private $modelClass; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $attribute; |
||
19 | |||
20 | /** |
||
21 | * RandomModelAttributeQuery constructor. |
||
22 | * |
||
23 | * @param string $modelClass |
||
24 | * @param string $attribute |
||
25 | */ |
||
26 | public function __construct(string $modelClass, string $attribute) |
||
27 | { |
||
28 | $this->modelClass = $modelClass; |
||
29 | $this->attribute = $attribute; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Retrieve a Query builder. |
||
34 | * |
||
35 | * @return Builder |
||
36 | */ |
||
37 | protected function builder(): Builder |
||
38 | { |
||
39 | return $this->modelClass::query(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Retrieve a random model attribute from all of the model records. |
||
44 | * |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function execute() |
||
54 | } |
||
55 | } |
||
56 |