Reputation: 1
I am using Sentinel for authentication for my grading system project with added features like social networking system and advance authentication system, my problem is:
$post = new Post;
$post->title=$request->title;
$post->body=$request->body;
$post->user_id = auth()->user()->id; //need to convert into a cartalyst way
$post->save();
I want the id of the user table to be saved on the user_id
of the posts table.
Upvotes: 0
Views: 45
Reputation: 734
Make a relation in Model then Use attach() function for attaching user to post for more info check Laravel Docs [https://laravel.com/docs/5.5/eloquent-relationships]
Upvotes: 0