Example #1
0
 protected function onPost(\Illuminate\Http\Request $input)
 {
     $id = $input->get('id');
     $this->data['update_success'] = false;
     try {
         $obj = Category::createFromInput($input, $id);
         $this->data['update_success'] = true;
     } catch (\App\Exceptions\Validation $ex) {
         $this->data['errors'] = $ex->validator->errors();
     } catch (\Exception $ex) {
         $this->errors->add('update-error', $ex->getMessage());
     }
     return parent::onPost($input);
 }
Example #2
0
 protected function onPost(\Illuminate\Http\Request $input)
 {
     $this->data['create_success'] = false;
     try {
         $obj = Category::createFromInput($input);
         $this->data['create_success'] = true;
         $this->view = 'admin.categories.edit';
         $this->data['category'] = $obj;
         return $this->redirect($this->plugin->categories_url('update', ['id' => $obj->id]));
     } catch (\App\Exceptions\Validation $ex) {
         dd($this->input);
         $this->data['errors'] = $ex->validator->errors();
     } catch (\Exception $ex) {
         $this->errors->add('create-error', $ex->getMessage());
     }
     return parent::onPost($input);
 }