0

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.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

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]

Vicky Gill
  • 714
  • 1
  • 7
  • 21