Nahid\Talk\Conversations\ConversationRepository::existsById PHP Метод

existsById() публичный Метод

* check this given user is exists
public existsById ( $id )
$id
    public function existsById($id)
    {
        $conversation = $this->find($id);
        if ($conversation) {
            return true;
        }
        return false;
    }

Usage Example

Пример #1
0
 /**
  * send a message by using converstionid.
  *
  * @param int    $conversationId
  * @param string $message
  * @return \Nahid\Talk\Messages\Message|bool
  */
 public function sendMessage($conversatonId, $message)
 {
     if ($conversatonId && $message) {
         if ($this->conversation->existsById($conversatonId)) {
             $message = $this->makeMessage($conversatonId, $message);
             return $message;
         }
     }
     return false;
 }