/** * Save a new initiative in storage * * @return \Dingo\Api\Http\Response */ public function store() { $payload = app('request')->all(); $validator = app('validator')->make($payload, Initiative::$rules); if ($validator->fails()) { $this->throwStoreResourceFailedException('Could not create new initiative.', $validator->errors()); } $initiative = Initiative::create($payload); return $this->response->created(url('initiatives/' . $initiative->id)); }