Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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 AppUser;

or $user = new AppUser; 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);
 
PREVIOUS NEXT
Tagged: #creating #default #object #empty #laravel
ADD COMMENT
Topic
Name
7+4 =