Skip to content

Instantly share code, notes, and snippets.

@damianoporta
Created March 16, 2015 16:04
Show Gist options
  • Save damianoporta/d46149602cf9fc02ff59 to your computer and use it in GitHub Desktop.
Save damianoporta/d46149602cf9fc02ff59 to your computer and use it in GitHub Desktop.
<namespace App\Routing\Route;
use Cake\Routing\Route\Route;
use Cake\ORM\TableRegistry;
class AdRoute extends Route
{
public function parse($url)
{
$params = parent::parse($url);
if (empty($params))
{
return false;
}
$result = TableRegistry::get('Ads')
->find()
->select(['id'])
->where(['url' => $url])
->first();
if (!$result)
{
return false;
}
return $params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment