1 | <?php |
||
8 | class PersonRepository |
||
9 | { |
||
10 | public function __construct(Person $model) |
||
14 | |||
15 | /** |
||
16 | * Returns all Persons. |
||
17 | * |
||
18 | * @return \Illuminate\Database\Eloquent\Collection|static[] |
||
19 | */ |
||
20 | public function all() |
||
25 | |||
26 | /** |
||
27 | * Returns all paginated Persons. |
||
28 | * |
||
29 | * @return \Illuminate\Database\Eloquent\Collection|static[] |
||
30 | */ |
||
31 | public function paginated() |
||
41 | |||
42 | /** |
||
43 | * Searches the orders. |
||
44 | * |
||
45 | * @return \Illuminate\Database\Eloquent\Collection|static[] |
||
46 | */ |
||
47 | public function search($payload, $count) |
||
61 | |||
62 | /** |
||
63 | * Stores Persons into database. |
||
64 | * |
||
65 | * @param array $payload |
||
66 | * |
||
67 | * @return Persons |
||
68 | */ |
||
69 | public function store($payload) |
||
73 | |||
74 | /** |
||
75 | * Find Persons by given id. |
||
76 | * |
||
77 | * @param int $id |
||
78 | * |
||
79 | * @return \Illuminate\Support\Collection|null|static|Persons |
||
80 | */ |
||
81 | public function find($id) |
||
85 | |||
86 | /** |
||
87 | * Find Persons by given id. |
||
88 | * |
||
89 | * @param int $id |
||
90 | * |
||
91 | * @return \Illuminate\Support\Collection|null|static|Persons |
||
92 | */ |
||
93 | public function getByCustomer($id) |
||
97 | |||
98 | /** |
||
99 | * Find Persons by given id. |
||
100 | * |
||
101 | * @param int $id |
||
102 | * |
||
103 | * @return \Illuminate\Support\Collection|null|static|Persons |
||
104 | */ |
||
105 | public function getByCustomerAndId($customer, $id) |
||
109 | |||
110 | /** |
||
111 | * Find Persons by given id. |
||
112 | * |
||
113 | * @param int $id |
||
114 | * |
||
115 | * @return \Illuminate\Support\Collection|null|static|Persons |
||
116 | */ |
||
117 | public function getByCustomerAndUuid($customer, $id) |
||
121 | |||
122 | /** |
||
123 | * Updates Persons into database. |
||
124 | * |
||
125 | * @param Person $order |
||
126 | * @param array $payload |
||
127 | * |
||
128 | * @return Persons |
||
129 | */ |
||
130 | public function update($order, $payload) |
||
140 | } |
||
141 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: