Laravel 5.3 中间件 class 不存在

Laravel 5.3 Middleware class does not exist

我想基于中间件进行一些身份验证..但不幸的是 returns 因为 class 不存在

这是我的中间件

Staff.php

<?php

namespace App\Http\Middleware;

use Closure;
use Auth;

class Staff
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $user = Auth::user()->type;
        if ($user == 'S'){
            return $next($request);
        }

        return "no";
    }
}

这是kernel.php

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    protected $middleware = [
        \App\http\Middleware\Staff::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
    }
}

我试过 composer dump-autoload 但没有效果。

这是我的路线:

Route::get('/staff', 'StaffController@index')->middleware('Staff');

如果您想将中间件应用于 Http 调用,您应该在 app/Http/Kernel.php 中注册它们。但是,您的中间件已在 App\Console\Kernel 中注册用于控制台命令。 参见 more on Laravel documentation