Answers for "creating default object from empty value laravel"

PHP
0

creating default object from empty value laravel

you haven't initialized the variable $user so in the controller and before using it you've to add $user = new User; assuming that you already have use App\User;

or $user = new \App\User; if you don't.

Update if you're trying to update an existing user record you've to initialize the $user variable by selecting based on it's primary key which should be sent in the request and then doing the initialization like:

$user_id = $request->input('user_id');
$user = User::find($user_id);
Posted by: Guest on March-20-2021

Code answers related to "creating default object from empty value laravel"

Browse Popular Code Answers by Language