Skip to content

Instantly share code, notes, and snippets.

@pyldin601
Last active March 25, 2016 15:30
Show Gist options
  • Save pyldin601/afd4d3f84f9e459ac184 to your computer and use it in GitHub Desktop.
Save pyldin601/afd4d3f84f9e459ac184 to your computer and use it in GitHub Desktop.
<?php
/**
* Define routes for your application in this file.
* Use $this keyword as Router instance.
*
* @var \Slang\Routing\Router $this
*/
$this->get("/", "HomeController::index", ["name" => "home"]);
$this->get("vakansii-v/:slug-c/", "VacancyListingController::vacanciesByCategory", ["name" => "vacancies:by:category"]);
$this->get(":city-r/vakansii/", "VacancyListingController::vacanciesInCity", ["name" => "vacancies.in.city"]);
$this->get("resume/:category-c/", "MockController::index", ["name" => "resume:by:category"]);
// Item routes
$this->get("vakansii/:vacancySlug/", "VacancyViewController::showVacancy", ["name" => "vacancy"]);
$this->get("companii/:companySlug/", "CompanyViewController::showCompany", ["name" => "company"]);
$this->get("resume/:resumeSlug/", "ResumeViewController::showResume", ["name" => "resume"]);
$this->get("test/:id/", function ($id) {
$vacancy = \App\Models\Vacancy::find($id)->getOrElse(null);
$vacancy->company;
return new \Slang\Http\Response\JsonResponse($vacancy);
});
$this->get("connection", function (\Slang\Database\Connection $connection, \Slang\Http\Response\JsonResponse $response) {
$visitor = new \Slang\Database\Fluorite\Concrete\MySqlStatementVisitor();
$statement = new \Slang\Database\Fluorite\Statements\SelectStatement();
$statement->addColumn(new \Slang\Database\Fluorite\Expressions\Column('*'));
$statement->addTable(new \Slang\Database\Fluorite\Expressions\Table('vacancy'));
$statement->setCriteria(
new \Slang\Database\Fluorite\Expressions\Criteria(
new \Slang\Database\Fluorite\Expressions\Comparison(
new \Slang\Database\Fluorite\Expressions\Column('id'),
\Slang\Database\Fluorite\Expressions\Comparison::EQ,
new \Slang\Database\Fluorite\Expressions\Value(399)
)
)
);
return $response->setData(
$connection->execute($visitor->visitSelectStatement($statement))->fetchOneRow()
);
});
//when("/vakansii/", "VacancyController.showAll", ["name" => "vacancies"]);
//when("/companies/", "MockController.index", ["name" => "companies"]);
//when("/resume/", "MockController.index", ["name" => "resumes"]);
//
//when("/:city-r/", "MockController.index", ["name" => "city"]);
//when("/:city-r/vakansii/:category-c/", "MockController.index", ["name" => "vacancies.by.city.category"]);
//when("/:city-r/vakansii/:tag/", "MockController.index", ["name" => "vacancies.by.city.tag"]);
//when("/:city-r/vakansii/:prof-v/", "MockController.index", ["name" => "vacancies.by.city.prof"]);
//when("/:city-r/resume/:category-re/", "MockController.index", ["name" => "resume.by.city.category"]);
//
//
//when("/vakansii/:tag/", "MockController.index", ["name" => "vacancies.by.tag"]);
//when("/vakansii/:prof-v/", "MockController.index", ["name" => "vacancies:by:category"]);
//
//when("/resume/:prof/", "MockController.index", ["name" => "resume.by.prof"]);
//
//$this->otherwise(function () { $GLOBALS["SLUNG_STATE"] = 0; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment