public function index() { // get the segments after our route prefix (/foo/bar) and feed into vanilla $segments = $this->request->segments(); if (forum_get_route_prefix() === head($segments)) { array_shift($segments); } // use a default if needed if (0 === count($segments)) { $segments = ['discussions']; } // run vanilla with the path and user we want $runner = new VanillaRunner(); $runner->login($this->mapper->current()); return $runner->view($segments); }
private function rewrite_url($path) { if (starts_with($path, 'http') || starts_with($path, '//')) { // absolute return $path; } else { if (starts_with($path, '{')) { // smarty template variable return $path; } else { if (empty($path)) { // self return \Request::url(); } else { // relative return forum_get_route_prefix() . '/' . ltrim($path, '/'); } } } }
/** * Execute the console command. * * @return mixed */ public function fire() { $setup = new VanillaSetup(); $setup->install(); $this->info('Vanilla now connected to Laravel. Try it out at ' . \URL::to(forum_get_route_prefix())); }
<?php /** * Define the package routes. * * All these routes exist under $prefix, which is configurable in * src/config/routes.php */ $prefix = forum_get_route_prefix(); Route::group(['prefix' => $prefix], function () use($prefix) { // default all routes through the vanilla passthru Route::any('{slug?}', ['uses' => '\\BishopB\\Forum\\PassthruController@index'])->where('slug', '^.*'); });
/** * We specifically always want our web root inside our route. */ public function WebRoot($WebRoot = NULL) { return forum_get_route_prefix(); }