app/Policies/PostPolicy.php
/**
     * Determine whether the user can view the model.
     *
     * @param \App\Models\User $user
     * @param \App\Models\Post $post
     * @return \Illuminate\Auth\Access\Response|bool
     */
Determine whether the user can view the model.
Determine whether the user can view the model .
public function author(User $user, Post $post)
    {
        if ($post->user_id == $user->id) {
            return true;
        } else {
            return false;
        }
    }
public function author ( User $ user , Post $ post ) { if ( $ post -> user_id == $ user -> id ) { return true ; } else { return false ; } }
Determine whether the user can view the model.
Determine whether the user can view the model .