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 \CachetHQ\Cachet\Models\Component */ public function getComponent($id) { return $this->component->findOrFail($id); } /** * Return a component with incidents. * * @param int $id * * @return \CachetHQ\Cachet\Models\Component */ public function getComponentIncidents($id) { return $this->component->with($id, ['incidents']); } /** * Create a new component. * * @return \CachetHQ\Cachet\Models\Component */ public function postComponents() { return $this->component->create($this->auth->user()->id, Binput::all()); } }