public function destroy($initiativeTypeId, $enhancementId) { $initiativeType = InitiativeType::findOrFail($initiativeTypeId); // Detach a single enhancement from the project type... $initiativeType->enhancements()->detach($enhancementId); return $this->response->noContent(); }
/** * Add a type to the initiative and save in storage * * @return \Dingo\Api\Http\Response */ public function store($initiativeId) { $payload = app('request')->all(); $payload['initiative_id'] = $initiativeId; $validator = app('validator')->make($payload, InitiativeType::$rules); if ($validator->fails()) { $this->throwStoreResourceFailedException('Could not add the project type to the initiative.', $validator->errors()); } $type = InitiativeType::create($payload); return $this->response->created(url('initiatives/' . $initiativeId . '/types/' . $type->id)); }