Created
March 16, 2015 16:04
-
-
Save damianoporta/d46149602cf9fc02ff59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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