コード例 #1
0
 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();
 }
コード例 #2
0
 /**
  * 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));
 }