Adds incident visibility. Closes #602

This commit is contained in:
James Brooks
2015-05-20 08:41:02 +01:00
committed by James Brooks
parent 9257135641
commit df2ae7726d
9 changed files with 89 additions and 6 deletions

View File

@@ -24,13 +24,16 @@ class IncidentController extends AbstractApiController
* Get all incidents.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \CachetHQ\Cachet\Models\Incident $incident
* @param \Illuminate\Contracts\Auth\Guard $auth
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getIncidents(Request $request)
public function getIncidents(Request $request, Guard $auth)
{
$incidents = Incident::paginate(Binput::get('per_page', 20));
$incidentVisiblity = $auth->check() ? 0 : 1;
$incidents = Incident::where('visible', '>=', $incidentVisiblity)
->paginate(Binput::get('per_page', 20));
return $this->paginator($incidents, $request);
}