Example #1
0
 public function action_create()
 {
     if (Input::method() == 'POST') {
         $val = Model_Selfgeneration::validate('create');
         if ($val->run()) {
             $selfgeneration = Model_Selfgeneration::forge(array('fname' => Input::post('fname'), 'sname' => Input::post('sname'), 'add1' => Input::post('add1'), 'add2' => Input::post('add2'), 'postcode' => Input::post('postcode'), 'telephone' => Input::post('telephone')));
             if ($selfgeneration and $selfgeneration->save()) {
                 Session::set_flash('success', 'Added selfgeneration #' . $selfgeneration->id . '.');
                 Response::redirect('selfgeneration');
             } else {
                 Session::set_flash('error', 'Could not save selfgeneration.');
             }
         } else {
             Session::set_flash('error', $val->error());
         }
     }
     $this->template->title = "Selfgenerations";
     $this->template->content = View::forge('selfgeneration/create');
 }