1 | <?php |
||
5 | trait DynamicRelations |
||
6 | { |
||
7 | use BaseEloquentOverrides; |
||
8 | |||
9 | protected static $methodAllowed = [ |
||
10 | 'getDynamicRelations', |
||
11 | 'hasDynamicRelation', |
||
12 | 'removeRelation', |
||
13 | 'defineRelation', |
||
14 | 'morphed_by_many', |
||
15 | 'has_many', |
||
16 | 'has_one', |
||
17 | 'belongs_to', |
||
18 | 'belongs_to_many', |
||
19 | 'morph_to_many', |
||
20 | 'morph_many', |
||
21 | 'morph_one', |
||
22 | 'morph_to', |
||
23 | 'has_many_through' |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * @var RelationStore |
||
28 | */ |
||
29 | protected static $dynamicRelations; |
||
30 | |||
31 | 9 | public static function bootDynamicRelations() |
|
35 | |||
36 | /** |
||
37 | * Dynamically handle calls to the class. |
||
38 | * |
||
39 | * @param string $method |
||
40 | * @param array $parameters |
||
41 | * @return mixed |
||
42 | * |
||
43 | * @throws \BadMethodCallException |
||
44 | */ |
||
45 | 9 | public function __call($method, $parameters) |
|
63 | |||
64 | /** |
||
65 | * Convert static call to |
||
66 | * |
||
67 | * @param string $method |
||
68 | * @param array $parameters |
||
69 | * @return mixed |
||
70 | * |
||
71 | * @throws \BadMethodCallException |
||
72 | */ |
||
73 | 9 | public static function __callStatic($method, $parameters) |
|
82 | |||
83 | |||
84 | 1 | public static function forceEagerLoading(...$relation) |
|
90 | } |
||
91 |