Move code to src folder

This commit is contained in:
Graham Campbell
2015-01-01 14:10:00 +00:00
parent 25af776e46
commit bf52b14bee
22 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,64 @@
<?php
namespace CachetHQ\Cachet\Controllers\Api;
use CachetHQ\Cachet\Repositories\Component\ComponentRepository;
use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Input;
class ComponentController extends Controller
{
use ControllerTrait;
protected $component;
public function __construct(ComponentRepository $component)
{
$this->component = $component;
}
/**
* Get all components.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getComponents()
{
return $this->component->all();
}
/**
* Get a single component.
*
* @param int $id
*
* @return \Component
*/
public function getComponent($id)
{
return $this->component->findOrFail($id);
}
/**
* Return a component with incidents.
*
* @param int $id Component ID
*
* @return \Component
*/
public function getComponentIncidents($id)
{
return $this->component->with($id, ['incidents']);
}
/**
* Create a new component.
*
* @return \Component
*/
public function postComponents()
{
return $this->component->create($this->auth->user()->id, Input::all());
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace CachetHQ\Cachet\Controllers\Api;
use CachetHQ\Cachet\Repositories\Incident\IncidentRepository;
use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Input;
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());
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace CachetHQ\Cachet\Controllers\Api;
use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Input;
class MetricController extends Controller
{
use ControllerTrait;
protected $metric;
public function __construct(MetricRepository $metric)
{
$this->metric = $metric;
}
/**
* Get all metrics.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getMetrics()
{
return $this->metric->all();
}
/**
* Get a single metric.
*
* @param int $id
*
* @return Metric
*/
public function getMetric($id)
{
return $this->metric->findOrFail($id);
}
/**
* Create a new metric.
*
* @return Metric
*/
public function postMetrics()
{
return $this->metric->create(Input::all());
}
/**
* Update an existing metric.
*
* @param int $id
*
* @return Metric
*/
public function putMetric($id)
{
return $this->metric->update($id, Input::all());
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace CachetHQ\Cachet\Controllers\Api;
use CachetHQ\Cachet\Repositories\MetricPoint\MetricPointRepository;
use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Input;
class MetricPointController extends Controller
{
use ControllerTrait;
protected $metricpoint;
public function __construct(MetricPointRepository $metricpoint)
{
$this->metricpoint = $metricpoint;
}
/**
* Get all metric points.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getMetricPoints()
{
return $this->metricpoint->all();
}
/**
* Get a single metric point.
*
* @param int $id
*
* @return MetricPoint
*/
public function getMetricPoint($id)
{
return $this->metricpoint->findOrFail($id);
}
/**
* Create a new metric point.
*
* @return MetricPoint
*/
public function postMetricPoints()
{
return $this->metricpoint->create(Input::all());
}
}