1 | <?php |
||
10 | trait ImageField |
||
11 | { |
||
12 | /** |
||
13 | * Intervention calls. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $interventionCalls = []; |
||
18 | |||
19 | /** |
||
20 | * Thumbnail settings. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $thumbnails = []; |
||
25 | |||
26 | /** |
||
27 | * Default directory for file to upload. |
||
28 | * |
||
29 | * @return mixed |
||
30 | */ |
||
31 | public function defaultDirectory() |
||
35 | |||
36 | /** |
||
37 | * Execute Intervention calls. |
||
38 | * |
||
39 | * @param string $target |
||
40 | * |
||
41 | * @return mixed |
||
42 | */ |
||
43 | public function callInterventionMethods($target) |
||
58 | |||
59 | /** |
||
60 | * Call intervention methods. |
||
61 | * |
||
62 | * @param string $method |
||
63 | * @param array $arguments |
||
64 | * |
||
65 | * @throws \Exception |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function __call($method, $arguments) |
||
86 | |||
87 | /** |
||
88 | * Render a image form field. |
||
89 | * |
||
90 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
91 | */ |
||
92 | public function render() |
||
98 | |||
99 | /** |
||
100 | * @param string|array $name |
||
101 | * @param int $width |
||
102 | * @param int $height |
||
103 | * |
||
104 | * @return $this |
||
105 | */ |
||
106 | public function thumbnail($name, int $width = null, int $height = null) |
||
120 | |||
121 | /** |
||
122 | * Destroy original thumbnail files. |
||
123 | * |
||
124 | * @return void. |
||
125 | */ |
||
126 | public function destroyThumbnail() |
||
147 | |||
148 | /** |
||
149 | * Upload file and delete original thumbnail files. |
||
150 | * |
||
151 | * @param UploadedFile $file |
||
152 | * |
||
153 | * @return $this |
||
154 | */ |
||
155 | protected function uploadAndDeleteOriginalThumbnail(UploadedFile $file) |
||
187 | } |
||
188 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: