Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function see(User $user, Post $post)
- {
- return $user->id === $post->user_id;
- }
- public function index()
- {
- $posts = Post::with('user')->where('user_id', 11)->get();
- return view('data', compact('posts'));
- }
- public function index()
- {
- $posts = Post::with('user')->where('user_id', 11)->get();
- $this->authorize('see', $posts);
- return view('posts.all')->with(['posts' => $posts]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement