app/Fovoritable.php
/**
     * Favorite the current reply.
     *
     * @return Model
     */
Favorite the current reply.
@return Model
Favorite the current reply . @return Model
public function favorite()
    {
        $attributes = ['user_id' => auth()->id()];
        if (! $this->favorites()->where($attributes)->exists()) {
            return $this->favorites()->create($attributes);
        }
    }
public function favorite ( ) { $ attributes = [ 'user_id' => auth ( ) -> id ( ) ] ; if ( ! $ this -> favorites ( ) -> where ( $ attributes ) -> exists ( ) ) { return $ this -> favorites ( ) -> create ( $ attributes ) ; } }
Favorite the current reply.
Favorite the current reply .