Skip to content

Instantly share code, notes, and snippets.

@bobmagicii
Last active August 29, 2015 14:26
Show Gist options
  • Save bobmagicii/ab9bd36fa7d40651fca1 to your computer and use it in GitHub Desktop.
Save bobmagicii/ab9bd36fa7d40651fca1 to your computer and use it in GitHub Desktop.
<?php
$router = (new Nether\Router)
->AddRoute('{@}//post/(#)','Routes\Post::ViewByID')
->AddRoute('{@}//admin/post(#)','Routes\Admin\Post::ViewByID');
try { $router->Run(); }
catch(...) { }
catch(...) { }
catch(...) { }
<?php
namespace Routes;
use \Nether;
class Post
extends Nether\Avenue\PublicAPI {
public function
ViewByID($id) {
// ...
}
}
<?php
namespace Routes\Admin;
use \Nether;
// if admin view is vastly different.
class Post
extends Nether\Avenue\PrivateAPI {
public function
ViewByID($id) {
// ...
}
}
<?php
namespace Routes\Admin;
use \Routes;
// if admin view is almost the same.
class Post
extends Routes\Post {
public function
ViewByID($id) {
$this->RequireAdmin();
// ...
return parent::ViewByID($id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment