DB Not Found Error In Laravel

If you are using the DB facade outside of the root namespace if you don't include it or namespace it's usage you will get the "DB not found error". There are 2 ways you can solve this problem you can namespace the usage as follows:

\DB::table('users');

A better solution is to include this class by using the "use" keyword as follows:

use DB;