find() public method

Find a group by ID.
public find ( $groupId ) : Illuminate\Database\Eloquent\Collection | Model | static
$groupId
return Illuminate\Database\Eloquent\Collection | Illuminate\Database\Eloquent\Model | static
Ejemplo n.º 1
0
 /**
  * Find a group by id
  *
  * @param $group_id
  * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|static
  * @throws \Fenos\Notifynder\Exceptions\NotifynderGroupNotFoundException
  */
 public function findById($group_id)
 {
     $group = $this->groupRepo->find($group_id);
     if (is_null($group)) {
         $error = "Group Not Found";
         throw new NotifynderGroupNotFoundException($error);
     }
     return $group;
 }
Ejemplo n.º 2
0
 /** @test */
 function it_try_to_find_an_not_existing_group_by_id(NotifynderGroupDB $groupDB)
 {
     $group_id = 1;
     $groupDB->find($group_id)->shouldBeCalled()->willReturn(null);
     $this->shouldThrow(NotifynderGroupNotFoundException::class)->during('findById', [$group_id]);
 }