Make CachetHq acually be CachetHQ. Fix formatting.

This commit is contained in:
James Brooks
2014-11-26 23:20:31 +00:00
parent 37ccd2404e
commit 08360124ff
9 changed files with 242 additions and 231 deletions
@@ -1,51 +1,53 @@
<?php namespace CachetHq\Cachet\Controllers\Api;
<?php
use Input;
use Dingo\Api\Routing\Controller as DingoController;
use Dingo\Api\Auth\Shield;
use CachetHq\Cachet\Repositories\Component\ComponentRepository;
namespace CachetHQ\Cachet\Controllers\Api;
class ComponentController extends DingoController {
use Input;
use Dingo\Api\Routing\Controller as DingoController;
use Dingo\Api\Auth\Shield;
use CachetHQ\Cachet\Repositories\Component\ComponentRepository;
protected $auth;
class ComponentController extends DingoController {
protected $component;
protected $auth;
public function __construct(Shield $auth, ComponentRepository $component) {
$this->auth = $auth;
$this->component = $component;
protected $component;
public function __construct(Shield $auth, ComponentRepository $component) {
$this->auth = $auth;
$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);
}
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());
}
}
/**
* 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);
}
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());
}
}