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

Find notification by id.
public find ( $notificationId ) : Illuminate\Database\Eloquent\Collection | Model | static
$notificationId
Результат Illuminate\Database\Eloquent\Collection | Illuminate\Database\Eloquent\Model | static
 /**
  * Find a notification by ID
  *
  * @param $notification_id
  * @return NotificationModel|\Illuminate\Database\Eloquent\Model|static
  * @throws \Fenos\Notifynder\Exceptions\NotificationNotFoundException
  */
 public function find($notification_id)
 {
     $notification = $this->notifynderRepo->find($notification_id);
     if (is_null($notification)) {
         $error = "Notification Not found";
         throw new NotificationNotFoundException($error);
     }
     return $notification;
 }
Пример #2
0
 /** @test */
 public function it_read_one_notification_by_id(NotificationDB $notificationRepo)
 {
     $notification_id = 1;
     $notification = new Notification();
     $notificationRepo->find($notification_id)->shouldBeCalled()->willReturn($notification);
     $notificationRepo->readOne($notification)->shouldBeCalled()->willReturn($notification);
     $this->readOne($notification_id)->shouldReturnAnInstanceOf($notification);
 }