添加:

在app/Http/Middleware/下面新增中间件例如:app/Http/Middleware/Huodong.php

namespace App\Http\Middleware;

use Closure;

class Huodong
{

    //handle 是固定方法。
    public function handle($request,Closure $next)
    {
       if (time() < strtotime('2017-06-28')) {
            return redirect('member/huodong');
       }
       return $next($request);

       //$next 后面执行的逻辑 叫后置操作。
    }


}

中间件注册

app/Http/Kernel.php

 protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'huodong'  => \App\Http\Middleware\Huodong::class,   //这个是新增
    ];
}

中间件使用,在路由中增加

Route::get('member/huodong',['uses' => '[email protected]']);

//这个是中间件
Route::group(['middleware' => ['huodong']],function(){
    Route::get('member/huodong1',['uses' => '[email protected]']);
});