app/Models/Traits/Subscribable.php
/**
     * Add a subscription for this record by the given user.
     *
     * @param $user mixed - If null will use currently logged in user.
     * @return bool|Subscription
     * @throws
     */
Add a subscription for this record by the given user.
@param $user mixed - If null will use currently logged in user.
@return bool|Subscription
@throws
Add a subscription for this record by the given user . @param $user mixed - If null will use currently logged in user . @return bool|Subscription @throws
public function subscribe($user = null)
    {
        if (null === $user) {
            $user = auth()->user();
        }
        if ($this->user_id === $user->id) {
            return false;
        }
        return $this->subscriptions()->firstOrCreate(['user_id' => $user->id]);
    }
public function subscribe ( $ user = null ) { if ( null === $ user ) { $ user = auth ( ) -> user ( ) ; } if ( $ this -> user_id === $ user -> id ) { return false ; } return $ this -> subscriptions ( ) -> firstOrCreate ( [ 'user_id' => $ user -> id ] ) ; }
Add a subscription for this record by the given user.
Add a subscription for this record by the given user .
// Don't subscribe owner