예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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');
 }