Class Illuminate\Routing\Middleware\Rolemiddleware does not exist
<p>I am using laravel , when I am trying to inject middleware in router getting some error</p>

<p>my router code</p>

<pre><code>&lt;?php

Route::get('role',[
    'middleware' =&gt; 'Role:editor',
    'uses' =&gt; 'TestController@index',
])-&gt;middleware('role');

?&gt;
</code></pre>

<p>kernal.php</p>

<pre><code>protected $routeMiddleware = [
        'auth' =&gt; \App\Http\Middleware\Authenticate::class,
        'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'can' =&gt; \Illuminate\Foundation\Http\Middleware\Authorize::class,
        'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' =&gt; \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'Age' =&gt; \App\Http\Middlware\AgeMiddleware::class,
        'Role' =&gt; \App\Http\Middlware\RoleMiddleware::class,
    ];
</code></pre>

<p>RoleMiddleware.php</p>

<pre><code>&lt;?php

namespace App\Http\Middleware;

use Closure;

class RoleMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next, $role)
    {
        echo "Role: ".$role;
        return $next($request);
    }
}
</code></pre>

<p>?></p>

<p>Here is my TestController code:</p>

<pre><code>&lt;?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;


class Firstcontroller extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
        echo '&lt;br&gt;First Controller';
    }

?&gt;
</code></pre>

<p>I am getting an error: Class Illuminate\Routing\Middleware\Rolemiddleware does not exist. I am new to Laravel and using Laravel 5.3. Can you please tell me why it is giving me an error</p>