src/Discussion/DiscussionRepository.php
public function findOrFail($id, User $user = null)
    {
        $query = Discussion::where('id', $id);

        return $this->scopeVisibleTo($query, $user)->firstOrFail();
    }
public function findOrFail($id, User $user = null)
    {
        $query = Discussion::where('id', $id);

        return $this->scopeVisibleTo($query, $user)->firstOrFail();
    }
public function findOrFail ( $ id , User $ user = null ) { $ query = Discussion :: where ( 'id' , $ id ) ; return $ this -> scopeVisibleTo ( $ query , $ user ) -> firstOrFail ( ) ; }
Find a discussion by ID, optionally making sure it is visible to a
certain user, or throw an exception.

@param int $id
@param User $user
@return \Flarum\Discussion\Discussion
Find a discussion by ID optionally making sure it is visible to a certain user or throw an exception .