Exemplo n.º 1
0
 /**
  * Statuslabel create form processing.
  *
  * @return Redirect
  */
 public function postCreate(Request $request)
 {
     // create a new model instance
     $statuslabel = new Statuslabel();
     if (!$request->has('statuslabel_types')) {
         return redirect()->back()->withInput()->withErrors(['statuslabel_types' => trans('validation.statuslabel_type')]);
     }
     $statustype = Statuslabel::getStatuslabelTypesForDB($request->input('statuslabel_types'));
     // Save the Statuslabel data
     $statuslabel->name = e(Input::get('name'));
     $statuslabel->user_id = Auth::user()->id;
     $statuslabel->notes = e(Input::get('notes'));
     $statuslabel->deployable = $statustype['deployable'];
     $statuslabel->pending = $statustype['pending'];
     $statuslabel->archived = $statustype['archived'];
     $statuslabel->color = e(Input::get('color'));
     $statuslabel->show_in_nav = e(Input::get('show_in_nav'), 0);
     // Was the asset created?
     if ($statuslabel->save()) {
         // Redirect to the new Statuslabel  page
         return redirect()->to("admin/settings/statuslabels")->with('success', trans('admin/statuslabels/message.create.success'));
     }
     return redirect()->back()->withInput()->withErrors($statuslabel->getErrors());
 }