public static function store() { self::check_logged_in(); $user_logged_in = self::get_user_logged_in(); $params = $_POST; $attributes = array('name' => $params['name'], 'laatija_id' => $user_logged_in->id, 'hero1' => $params['hero1'], 'hero2' => $params['hero2'], 'hero3' => $params['hero3'], 'hero4' => $params['hero4'], 'hero5' => $params['hero5'], 'vaikeus' => $params['vaikeus'], 'suunnitelma' => $params['suunnitelma']); $draft = new Draft($attributes); $errors = $draft->errors(); if (count($errors) == 0) { $draft->save(); Redirect::to('/drafts' . $draft->id, array('message' => 'Drafti on lisätty arkistoon!')); } else { $heroes = Hero::all(); View::make('drafts/new.html', array('errors' => $errors, 'attributes' => $attributes, 'heroes' => $heroes)); } }
public function heroTable() { //return json_encode( Hero::select(array('filiacao' => 'SENTINEL', 'atributo' => 'INTELIGENCE'))); return json_encode(Hero::all()); }
public static function lista() { $heroes = Hero::all(); View::make('hero/lista.html', array('heroes' => $heroes)); }