1 | <?php |
||
19 | trait ChuteImageModelTrait |
||
20 | { |
||
21 | /** |
||
22 | * Upload Image |
||
23 | * |
||
24 | * Perform the image upload process |
||
25 | * |
||
26 | * @param $file |
||
27 | * @param $name |
||
28 | * @return \HustleWorks\Chute\ServiceResponse |
||
29 | */ |
||
30 | public function uploadImage($file, $name) |
||
40 | |||
41 | /** |
||
42 | * Image URl |
||
43 | * |
||
44 | * @param $name |
||
45 | * @param null $size |
||
46 | * @return \HustleWorks\ChuteLaravel\Models\ImageTransformation|string |
||
47 | */ |
||
48 | public function imageUrl($name, $size = null) |
||
55 | |||
56 | /** |
||
57 | * Image Upload Configuration |
||
58 | * |
||
59 | * @param null $image_name |
||
60 | * @return ImageConfiguration |
||
61 | */ |
||
62 | public function imageUploadConfig($image_name = null) |
||
74 | |||
75 | /** |
||
76 | * Images |
||
77 | * |
||
78 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
79 | */ |
||
80 | private function images() |
||
84 | |||
85 | } |
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.