コード例 #1
0
 public function create()
 {
     $params = \Input::all();
     if (!empty($params)) {
         $validator = \Validator::make($params, array('name' => array('required')));
         if (!$validator->fails()) {
             $ui_profile = new UiProfile();
             $ui_profile->fill($params);
             $ui_profile->root = 0;
             if ($ui_profile->save()) {
                 return \Redirect::to('uiadmin/uiprofile');
             }
         } else {
             $messages = $validator->messages();
             $this->_dataView['messages_errors'] = $messages->all();
         }
     }
     $ui_profile = new UiProfile();
     $this->_dataView['ui_profile'] = $ui_profile;
     $this->_dataView['module_action'] = 'Adicionar';
     return view('uiprofile::form', $this->_dataView);
 }