Exemplo n.º 1
0
 /**
  * Get all incidents.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getIncidents()
 {
     $incidentVisibility = app(Guard::class)->check() ? 0 : 1;
     $incidents = Incident::where('visible', '>=', $incidentVisibility);
     $incidents->search(Binput::except(['sort', 'order', 'per_page']));
     if ($sortBy = Binput::get('sort')) {
         $direction = Binput::has('order') && Binput::get('order') == 'desc';
         $incidents->sort($sortBy, $direction);
     }
     $incidents = $incidents->paginate(Binput::get('per_page', 20));
     return $this->paginator($incidents, Request::instance());
 }
Exemplo n.º 2
0
 /**
  * Get all incidents.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Illuminate\Contracts\Auth\Guard          $auth
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function getIncidents(Request $request, Guard $auth)
 {
     $incidentVisiblity = $auth->check() ? 0 : 1;
     $incidents = Incident::where('visible', '>=', $incidentVisiblity)->paginate(Binput::get('per_page', 20));
     return $this->paginator($incidents, $request);
 }
Exemplo n.º 3
0
 /**
  * Get all incidents.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getIncidents()
 {
     $incidentVisibility = app(Guard::class)->check() ? 0 : 1;
     $incidents = Incident::where('visible', '>=', $incidentVisibility)->paginate(Binput::get('per_page', 20));
     return $this->paginator($incidents, Request::instance());
 }