/** * Default action. Set the public layout (layouts/default.volt) */ public function indexAction() { $motorbikes = Motorbikes::find(array('order' => 'created_at DESC', 'limit' => 2)); $this->view->motorbikes = $motorbikes; $this->view->setTemplateBefore('default'); }
/** * Deletes a motorbike * * @param string $id */ public function deleteAction($id) { $motorbike = Motorbikes::findFirstByid($id); if (!$motorbike) { $this->flash->error("motorbike was not found"); return $this->forward(array("controller" => "motorbikes", "action" => "index")); } if (!$motorbike->delete()) { foreach ($motorbike->getMessages() as $message) { $this->flash->error($message); } return $this->forward(array("controller" => "motorbikes", "action" => "search")); } $this->flash->success("motorbike was deleted successfully"); return $this->forward(array("controller" => "motorbikes", "action" => "index")); }