Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. public function see(User $user, Post $post)
  2. {
  3. return $user->id === $post->user_id;
  4. }
  5.  
  6. public function index()
  7. {
  8. $posts = Post::with('user')->where('user_id', 11)->get();
  9. return view('data', compact('posts'));
  10. }
  11.  
  12. public function index()
  13. {
  14. $posts = Post::with('user')->where('user_id', 11)->get();
  15. $this->authorize('see', $posts);
  16. return view('posts.all')->with(['posts' => $posts]);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement