app/Models/Traits/Notificable.php
/**
     * Add a notification for this record for the given user.
     *
     * @param User $user
     * @param      $data
     */
Add a notification for this record for the given user.
@param User $user
@param      $data
Add a notification for this record for the given user . @param User $user @param $data
public function notify($user, $data = null)
    {
        $notification = $this->notifications()
                     ->where('user_id', '=', $user->id)
                     ->first();
        if ($notification) {
            $notification->update(['seen' => 0, 'data' => $data]);
            return;
        }
        $this->notifications()->create(['user_id' => $user->id, 'data' => $data]);
    }
public function notify ( $ user , $ data = null ) { $ notification = $ this -> notifications ( ) -> where ( 'user_id' , '=' , $ user -> id ) -> first ( ) ; if ( $ notification ) { $ notification -> update ( [ 'seen' => 0 , 'data' => $ data ] ) ; return ; } $ this -> notifications ( ) -> create ( [ 'user_id' => $ user -> id , 'data' => $ data ] ) ; }
Add a notification for this record for the given user.
Add a notification for this record for the given user .