Exemple #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $data = new Items($request->all());
     $data->id = Items::newId();
     if (!Persons::find($data->user_id)) {
         return $this->error("Wrong Person#id");
     }
     if ($data->save()) {
         return $this->success($data);
     } else {
         return $this->error("Couldn't create new Person");
     }
 }