app->environment('production')) { \URL::forceScheme('https'); } \Route::bind('user', function ($value) { $u = User::where('name', $value)->first(); // it may also be the _id directly if (!$u) $u = User::find($value); return $u; }); } /** * Register any application services. * * @return void */ public function register() { $this->app->singleton(WidgetFactory::class, function () { return new WidgetFactory(); }); } }