1 | <?php namespace BB\Repo; |
||
6 | class EquipmentRepository extends DBRepository |
||
7 | { |
||
8 | |||
9 | /** |
||
10 | * @var Equipment |
||
11 | */ |
||
12 | protected $model; |
||
13 | |||
14 | public function __construct(Equipment $model) |
||
18 | |||
19 | public function all() |
||
23 | |||
24 | public function getRequiresInduction() |
||
28 | |||
29 | public function getDoesntRequireInduction() |
||
33 | |||
34 | |||
35 | public function allPaid() |
||
39 | |||
40 | /** |
||
41 | * Return a device by its slug |
||
42 | * @param $slug |
||
43 | * @return Equipment |
||
44 | */ |
||
45 | public function findBySLug($slug) |
||
53 | |||
54 | /** |
||
55 | * Return a device by its slug |
||
56 | * @param $slug |
||
57 | * @return Equipment |
||
58 | */ |
||
59 | public function findByDeviceKey($device) |
||
63 | } |
||
64 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: