Using DB in Middleware Lumen

0

I'm trying to get an instance of the DB class inside my Middleware and it's giving the following error:

Class 'DB' not found

public function handle($request, Closure $next) {

    $results = DB::select("SELECT * FROM usuarios");
    var_dump($results);
    return $next($request);

}

How do I use the DB class at this point in the code?

    
asked by anonymous 05.04.2017 / 01:49

1 answer

0

Add after the Middleware class namespace the following line:

use Illuminate\Support\Facades\DB;

    
23.08.2017 / 23:59