1 | <?php |
||
10 | class PersonService |
||
11 | { |
||
12 | public function __construct( |
||
17 | |||
18 | /** |
||
19 | * Get all Persons. |
||
20 | * |
||
21 | * @return Collection |
||
22 | */ |
||
23 | public function all() |
||
27 | |||
28 | /** |
||
29 | * Get all Persons. |
||
30 | * |
||
31 | * @return Illuminate\Pagination\LengthAwarePaginator |
||
32 | */ |
||
33 | public function paginated() |
||
37 | |||
38 | /** |
||
39 | * Find the Person by ID. |
||
40 | * |
||
41 | * @param int $id |
||
42 | * |
||
43 | * @return Persons |
||
44 | */ |
||
45 | public function find($id) |
||
49 | |||
50 | /** |
||
51 | * Search the orders. |
||
52 | * |
||
53 | * @param array $payload |
||
54 | * |
||
55 | * @return Collection |
||
56 | */ |
||
57 | public function search($payload) |
||
61 | |||
62 | /** |
||
63 | * Create an order. |
||
64 | * |
||
65 | * @param array $payload |
||
66 | * |
||
67 | * @return Persons |
||
68 | */ |
||
69 | public function create($payload) |
||
77 | |||
78 | /** |
||
79 | * Update an order. |
||
80 | * |
||
81 | * @param int $id |
||
82 | * @param array $payload |
||
83 | * |
||
84 | * @return Persons |
||
85 | */ |
||
86 | public function update($id, $payload) |
||
96 | |||
97 | /** |
||
98 | * Cancel an order. |
||
99 | * |
||
100 | * @param int $id |
||
101 | * |
||
102 | * @return Persons |
||
103 | */ |
||
104 | public function cancel($orderId) |
||
149 | } |
||
150 |
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: