Inspecting The Current RouteIf you would like to determine if the current request was routed to a given named route, you may use the named method on a Route instance. For example, you may check the current route name from a route middleware:...
For example, you may check the current route name from a route middleware:1use Closure; 2use Illuminate\Http\Request; 3use Symfony\Component\HttpFoundation\Response; 4 5/** 6 * Handle an incoming request. 7 * 8 * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\Http...
RouteRegistrar 主要负责位于group 、method 这些函数之前的属性注册,Route主要负责位于group 、method这些函数之后的属性注册,而Router则是解析过程中一个中转,将domain、prefix这些熟悉的注册处理转交给RouteRegistrar,并在自身处理method之后返回生成的路由实例Route,将where、name等约束的处理交给Route进行。路由解析的过程...
$routes = $this->get($request->getMethod()); // First, we will see if we can find a matching route for this current request // method. If we can, great, we can just return it so that it can be called // by the consumer. Otherwise we will check for routes with another verb....
Route::get('blade', function () { return view('child'); }); 显示数据 你可以使用花括号 { 来在视图中显示传递到视图中的变量,例如,你定义了下面的路由: Route::get('greeting', function () { return view('welcome', ['name' => 'Duicode']); }) ...
Checks if the current route name is not equal to the given parameter. You can use a wildcard like blog.post.*@routeisnot('webshop.checkout') Do something only if this is not the checkout @endrouteisnot@instanceofChecks if the first parameter is an instance of the second parameter....
}server{listen80;# 别忘了绑Hostserver_namelaravels.com;root/yourpath/laravel-s-test/public;access_log/yourpath/log/nginx/$server_name.access.log main;autoindexoff;indexindex.html index.htm;# Nginx处理静态资源(建议开启gzip),LaravelS处理动态资源。location/ {try_files$uri@laravels; ...
if ($this->auth->guard($guard)->check()) {//使用指定的guard中第一个能成功认证的 return $this->auth->shouldUse($guard);//将指定guard设置为 本次请求的默认guard。(本次请求后续获取authed user时,都通过这里设置的guard进行) } } throw new AuthenticationException('Unauthenticated.', $guards);...
Route Middleware Method To enable this mode, you need to publish the configuration file (see the configuration section above) and then setuse-route-middlewaretotrue. This will disable the default global middleware mode (which applies it to any page that has the CSRF token in it across your...
check(Request $request){$path = $request->input('path', $this->path);$filename = $request->input('filename', null);if($filename){if(!file_exists($path . $filename)){Flash::error('磁盘文件已删除,刷新文件列表');}else{Flash::success('文件有效');}}return redirect(route('files')...