I'm trying to get my menu to display the current class, I can do it with the id, but at the moment I'm using my seo table to display a url.html instead of an id.
My route
Route::get('/{id}', function($id = 1){
if(is_numeric($id))
{
$menu = App\Modules\Menu\Models\Menu::find($id);
$action = 'content';
return App::make('App\Modules\Open\Http\Controllers\OpenController')->$action($id);
}else{
$column = 'url';
$url = App\Modules\Seo\Models\Seo::where($column, '=', $id)->get();
$seo = App\Modules\Seo\Models\Seo::where('url', $id)->firstOrFail();
foreach($seo->menu as $test){
$test_url = $test->id;
}
$action = 'content';
return App::make('App\Modules\Open\Http\Controllers\OpenController')->$action($test_url);
}
});
My menu_active function in my helpers.php
function menu_active($test_url){
if(is_array($id)){
return in_array(Request::path(), $test_url) ? 'current' : '';
}
return Request::path() == $test_url ? 'current' : '';
}
via Isis