Hi, I am trying to create a user with a profile table related so far...
$newUser = User::create([ 'name' => 'daniel', 'email' => '[email protected]', 'password' => Hash::make(123), ]); Profile::create([ 'user_id' => $newUser->id, 'nombre' => 'Adminer', 'apellido' => 'Jhonson', ]);
this is working but I thing there should be a better way to do it... can some one help me? am using for a role this one
I love this way
so I want to make something like this
$newUser->Profile()->attach($newUser->id); // this is my idea to create an attached table to that ID user
thanks in advance for your help