Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public function store(AttachmentRequest $request) |
||
11 | { |
||
12 | $imageName = time().'.'.$request->attachment->getClientOriginalExtension(); |
||
|
|||
13 | |||
14 | $data = [ |
||
15 | 'attachmentable_id' => $request->attachmentable_id, |
||
16 | 'attachmentable_type' => $request->attachmentable_type, |
||
17 | 'filename_original' => $request->attachment->getClientOriginalName(), |
||
18 | 'filename_new' => $imageName, |
||
19 | 'mimetype' => $request->attachment->getMimeType(), |
||
20 | 'size' => $request->attachment->getSize(), |
||
21 | ]; |
||
22 | |||
23 | $request->attachment->move(public_path('attachments'), $imageName); |
||
24 | |||
25 | Attachment::create($data); |
||
26 | |||
27 | return back()->with('success', trans('File uploaded successfully')); |
||
28 | } |
||
29 | } |
||
30 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.