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());
}
}