public function getJob($req) { $cr = new CategoriesRepository(); $categories = $cr->getAll(); $jr = new JobsRepository(); $job = $jr->getById($req->id); return $this->twig->render('job.html', compact('categories', 'job')); }
public function getEdit($req) { $jr = new JobsRepository(); $job = $jr->getById($req->id); $cr = new CategoriesRepository(); $categories = $cr->getAll(); $ar = new ApplicationsRepository(); $applications = $ar->getByJobId($req->id); return $this->twig->render('admin/jobs/edit.html', compact('job', 'categories', 'applications')); }
public function getDelete($req) { $jr = new JobsRepository(); $jr->deleteByCategoryId($req->id); $cr = new CategoriesRepository(); $category = $cr->getById($req->id); $result = $category->delete(); if ($result) { $this->service->flash('The category and its additional jobs have been deleted.', 'success'); } else { $this->service->flash('Can\'t delete the category.', 'alert'); } return $this->service->back(); }