| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 26 | public function add(Request $request) |
||
| 27 | {
|
||
| 28 | $validator = Validator::make($request->all(), [ |
||
| 29 | 'postcode' => 'required|integer', |
||
| 30 | 'country' => 'required', |
||
| 31 | 'address' => 'required', |
||
| 32 | ]); |
||
| 33 | |||
| 34 | if ($validator->fails()) {
|
||
| 35 | return redirect('/creator')
|
||
| 36 | ->withInput() |
||
| 37 | ->withErrors($validator); |
||
| 38 | } |
||
| 39 | $id = Auth::user()->id; |
||
| 40 | $creator = new Creator(); |
||
| 41 | $creator->postcode = $request->postcode; |
||
|
|
|||
| 42 | $creator->country = $request->country; |
||
| 43 | $creator->home_address = $request->address; |
||
| 44 | $creator->user_id = $id; |
||
| 45 | $creator->save(); |
||
| 46 | DB::update('update users set isCreator = 1 where id = ?', [$id]);
|
||
| 47 | |||
| 48 | return redirect('/new');
|
||
| 49 | } |
||
| 50 | } |
||
| 51 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write 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.