I think (not testet) you can use the explicit binding in your RouteServiceProvider. Check the documentation here: https://laravel.com/docs/5.6/routing#route-model-binding
and try this in your RouteServiceProvider
Route::bind('uid', function ($value) {
return App\User::where('id', $value)->first() ?? abort(404);
});
Route::bind('uslug', function ($value) {
return App\User::where('slug', $value)->first() ?? abort(404);
});
and in your Routes
// frontend
Route::get('profile/{uslug}', function (App\User $user) {
//
});
//backend
Route::get('admin/{uid}', function (App\User $user) {
//
});
as i said, i didn't test it and can't test it right now :(