public static function destroy($id)
 {
     self::check_logged_in();
     $hero = new Hero(array('id' => $id));
     $yhteys = new Yhteys(array('hero_id' => $id));
     $draftids = Yhteys::findDraftID($id);
     $yhteys->destroy();
     while ($draftids != NULL) {
         $draft = new Draft(array('id' => $draftids->draft_id));
         $draft->destroy();
         $draftids = Yhteys::findDraftID($id);
     }
     $hero->destroy();
     Redirect::to('/hero', array('message' => 'Hero on poistettu onnistuneesti!'));
 }
Exemplo n.º 2
0
 public static function show($id)
 {
     self::check_logged_in();
     $draft = Draft::find($id);
     $kayttajat = Kayttaja::find($draft->laatija_id);
     $heroes = Yhteys::findHero($id);
     View::make('drafts/show.html', array('draft' => $draft, 'heroes' => $heroes, 'kayttajat' => $kayttajat));
 }