public function view() { $body_type = BodyTypeModel::factory()->getById($this->body_type_id); $cars = CarModel::factory()->getByBodyTypeId($this->body_type_id); $this->set('body_type', $body_type); $this->set('cars', $cars); }
public function view($body_type_url_slug = null) { if (!empty($body_type_url_slug)) { $cars = CarModel::factory()->getByBodyTypeUrlSlug($body_type_url_slug); } else { $cars = CarModel::factory()->getAll(); } $this->set('cars', $cars); }
public function delete($id) { if (empty($id) || !intval($id)) { $this->render404AndExit(); } $model = CarModel::factory(); $record = $model->getById($id); if (!$record) { $this->render404AndExit(); } if ($this->post()) { $model->delete($id); $this->flash('Car Deleted.'); $this->redirect("view?body_type={$record['body_type_id']}"); } $this->setArray($record); $this->render('delete'); }
public function getListModelAction() { $brandId = $this->request->getQuery('id'); $models = CarModel::find(array("brandId = ?0", "bind" => [$brandId]))->toArray(); echo json_encode($models); }