I have a lot of new things for opps and laravel as So, to insert values into a table usersand profileswhich has a relation hav OneToOne, Here is what my method looks likestore()
public function store(Requests\StoreNewUser $request)
{
$user = new \App\User;
$user->first_name = $request->input('first_name');
$user->last_name = $request->input('last_name');
$user->email = $request->input('email');
$user->password = $request->input('password');
$user->profile()->user_id = $user->id;
$user->profile()->mobile_no = $request->input('mobile');
dd($user);
}
I am creating a new record, so it dd()never returns anything related to the profile table.
Is this because the object $userdoes not include the default relationship? If so, can I create an object $userthat includes related relationships in UserModel?
Or I need to create two separate objects for each table and save()data.
But what is the meaning of the method push()?
EDIT 1
Postscript yes, relationships are already defined in Userand Profilemodel