Just like in the documentation

public function store(Request $request) { $sponsor = new Sponsor; if ($sponsor->validate($request->all())) { $sponsor->name = $request->name; $sponsor->text = $request->text; $sponsor->logo = $request->logo; //TODO: Upload logo $sponsor->save(); return $sponsor; } else { return ['errors' => $sponsor->errors()]; } } 

Checked what comes in $ request - there is data, and it is added to the $ sponsor object, but it is not saved to the database.

    1 answer 1

    Review the data validation moment:

      $this->validate($request, [ 'title' => 'required|unique:posts|max:255', 'body' => 'required', ]); 

    A validate method accepts an incoming HTTP request and a set of validation rules. If the validation rules pass, your code will keep executing normally; however, it will be sent back to the user.

    More information in the documentation: https://laravel.com/docs/5.3/validation