Exemple #1
0
 public function action_create()
 {
     if (Input::method() == 'POST') {
         $val = Model_Request::validate('create');
         if ($val->run()) {
             $request = Model_Request::forge(array('body' => Input::post('body'), 'ip' => Input::ip()));
             if ($request and $request->save()) {
                 Session::set_flash('success', 'Added request #' . $request->id . '.');
                 Response::redirect('request');
             } else {
                 Session::set_flash('error', 'Could not save request.');
             }
         } else {
             Session::set_flash('error', $val->error());
         }
     }
     $this->template->title = "Requests";
     $this->template->content = View::forge('request/create');
 }