public static function get_from_id($id) { $bill = new Bill(); $bill->load($id); return $bill; }
<?php # controllers/deletebill.php # Logic Auth::kickout_non_admin('/'); $bill = new Bill(); $bill->load(Route::param('id')); $bill->delete(); $accounts = new Accounts_Collection(); $accounts->where('bill_id', $bill->id); $accounts->get(); foreach ($accounts->items as $account) { $account->delete(); } # Redirect URL::redirect('/admin');