Im learning Laravel right know and im bumped in to a little problem.
I have created a login system that works just fine. When a user is logged in he can create different posts.
Now the problem is when i login with for example Bob and create posts i can se all Bobs post in his profile page and that is OK!
But the problem i have is when i login with Alice i can see Bobs post and thats what i cant figure out how to solve.
I have some code that set the relations between user and post:
//Post Model
public function users(){
return $this->hasMany('Posts');
}
//User Model
public functon posts(){
return $this->belongsTo('User');
}
Now how can i show Alice posts only when i login to Alice account?