I have a simple dashboard in which users can register and do some stuff, now I would like to generate a file with username and his id; something like widget/obama2030.js in Laravel when a user is registered
my app structure:
myapp
-app
-bootstrap
-database
-resource
.....
-widget
-------
in my user registration controller, I have the following.
protected function create(array $data)
{
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
File::makeDirectory('/widget/'.$user->name.Auth::user()->id, 0755, true);
return $user;
}
Now when user click the button register I am getting the following error
ErrorException (E_NOTICE)
Trying to get property of non-object
what is wrong with my code????
/widget/...jsto output something that's specific to that user, right?! Well, how do you implement something like a user profile page, or any other regular Laravel page that outputs something specific to the currently logged in user, or otherwise something user-specific? You don't create a bunch of separate HTML files, right? You have a Laravel controller and view that you dynamically generate from info from the database, or whatever. Same thing.