1 | <?php |
||
5 | trait ModelForm |
||
6 | { |
||
7 | /** |
||
8 | * Display the specified resource. |
||
9 | * |
||
10 | * @param int $id |
||
11 | * |
||
12 | * @return \Illuminate\Http\Response |
||
13 | */ |
||
14 | public function show($id) |
||
18 | |||
19 | /** |
||
20 | * Update the specified resource in storage. |
||
21 | * |
||
22 | * @param int $id |
||
23 | * |
||
24 | * @return \Illuminate\Http\Response |
||
25 | */ |
||
26 | public function update($id) |
||
30 | |||
31 | /** |
||
32 | * Remove the specified resource from storage. |
||
33 | * |
||
34 | * @param int $id |
||
35 | * |
||
36 | * @return \Illuminate\Http\Response |
||
37 | */ |
||
38 | public function destroy($id) |
||
52 | |||
53 | /** |
||
54 | * Store a newly created resource in storage. |
||
55 | * |
||
56 | * @return \Illuminate\Http\Response |
||
57 | */ |
||
58 | public function store() |
||
62 | } |
||
63 |
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.