Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | * @return JsonResponse |
||
19 | */ |
||
20 | public function upload(StoreFormRequest $request, Filesystem $files) |
||
21 | { |
||
22 | $path = storage_path('tmp'); |
||
23 | |||
24 | if (!$files->isDirectory($path)) { |
||
25 | $files->makeDirectory($path, 0777, true); |
||
26 | } |
||
27 | |||
28 | $file = $request->file('file'); |
||
29 | |||
30 | $file->move($path, $name = uniqid() . '_' . trim($file->getClientOriginalName())); |
||
31 | |||
32 | return response()->json([ |
||
|
|||
33 | 'name' => $name, |
||
34 | 'original_name' => $file->getClientOriginalName(), |
||
35 | ]); |
||
54 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: