1 | <?php |
||
9 | abstract class Model |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $magicProperties = []; |
||
15 | |||
16 | /** |
||
17 | * @param array ...$types |
||
18 | * |
||
19 | * @return $this |
||
20 | */ |
||
21 | 2 | public function with(...$types) { |
|
22 | 2 | foreach ($types as $type) { |
|
23 | 2 | if (method_exists($this, strtolower($type))) |
|
24 | 2 | call_user_func([$this, $type]); |
|
25 | } |
||
26 | |||
27 | 2 | return $this; |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param $name |
||
32 | * @return mixed |
||
33 | * @throws \Exception |
||
34 | */ |
||
35 | 4 | public function __get($name) |
|
43 | } |