Files
cachet-docker/app/CachetHq/Cachet/Controllers/Api/IncidentController.php
Elliot Hesp b2e1d2750c Updated DingoAPI to .7
Rename component.component to component_id with relationship name change

Rename more instances of parent to component

Working on Incident Repository

Fix Incident seeder

component_id is fillable within the model

Fix bad relationship

Finished Incident repository

Added Metric repository

Updated tests for new dingo release
2014-12-01 14:48:49 +00:00

60 lines
1.2 KiB
PHP

<?php
namespace CachetHQ\Cachet\Controllers\Api;
use Input;
use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller;
use CachetHQ\Cachet\Repositories\Incident\IncidentRepository;
class IncidentController extends Controller {
use ControllerTrait;
protected $incident;
public function __construct(IncidentRepository $incident) {
$this->incident = $incident;
}
/**
* Get all incidents
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getIncidents() {
return $this->incident->all();
}
/**
* Get a single incident
*
* @param int $id
*
* @return Incident
*/
public function getIncident($id) {
return $this->incident->findOrFail($id);
}
/**
* Create a new incident
*
* @return Incident
*/
public function postIncidents() {
return $this->incident->create($this->auth->user()->id, Input::all());
}
/**
* Update an existing incident
*
* @param int $id
*
* @return Incident
*/
public function putIncident($id) {
return $this->incident->update($id, Input::all());
}
}