/** * Create a new user * * @return boolean */ public function create(array $input) { if (!$this->valid($input)) { return false; } return $this->user->create($input); }
/** * Create a new snippet * * @return boolean */ public function create(array $input) { if (!$this->valid($input)) { return false; } // validate if tags chosen are valid // @TODO: move this into a helper so we can re-use this one $tagIds = $this->tag->all()->lists('id'); if (isset($input['tags']) && count($input['tags']) > 0) { foreach ($input['tags'] as $id) { if (!in_array($id, $tagIds)) { return App::abort(404); } } } return $this->snippet->create($input); }