Skip to content

Instantly share code, notes, and snippets.

@xiaohutai
Created February 23, 2018 08:46
Show Gist options
  • Save xiaohutai/ea8ab27aa5cfdcd1e8b972e7e38bce62 to your computer and use it in GitHub Desktop.
Save xiaohutai/ea8ab27aa5cfdcd1e8b972e7e38bce62 to your computer and use it in GitHub Desktop.
<?php
public function onMountControllerAfter(MountEvent $event){
$app = $event->getApp();
foreach ($this->registerFrontendControllers() as $prefix => $collection) {
$event->mount($prefix, $collection);
}
if ($app['routes']->count() > 0) {
$nullRoute = function(){ throw new NotFoundHttpException(); };
$app['controllers']->match('/', $nullRoute)->bind('preview');
$app['controllers']->match('/', $nullRoute)->bind('contentlink');
$app['controllers']->match('/', $nullRoute)->bind('contentlisting');
$app['controllers']->match('/', $nullRoute)->bind('taxonomylink');
}
}
/** {@inheritdoc} */
public static function getSubscribedEvents() {
return [
ControllerEvents::MOUNT => [
['onMountControllerAfter' , -100],
],
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment