1 | <?php |
||
5 | trait ModelForm |
||
6 | { |
||
7 | /** |
||
8 | * Update the specified resource in storage. |
||
9 | * |
||
10 | * @param int $id |
||
11 | * |
||
12 | * @return \Illuminate\Http\Response |
||
13 | */ |
||
14 | public function update($id) |
||
18 | |||
19 | /** |
||
20 | * Remove the specified resource from storage. |
||
21 | * |
||
22 | * @param int $id |
||
23 | * |
||
24 | * @return \Illuminate\Http\Response |
||
25 | */ |
||
26 | public function destroy($id) |
||
40 | |||
41 | /** |
||
42 | * Store a newly created resource in storage. |
||
43 | * |
||
44 | * @return \Illuminate\Http\Response |
||
45 | */ |
||
46 | public function store() |
||
50 | } |
||
51 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.