0
I am trying to get an instance of the DB class inside my Middleware and is 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?
ever tried to put a bar in front? With me it works because the autoloader does not search at the root:
\DB::select(...)
– Daniel
follows the same error
– AndersonSouza
Look, it’s certainly the way to class that’s missing. I’ve never used the Lumen, but it shouldn’t be far from it. Check out the documentation: https://lumen.laravel.com/docs/5.4/database
– Daniel