wp-eloquent
wp-eloquent copied to clipboard
A facade root has not been set
When I try to get data like this
$result = DB::table('wp_users')->get();
I get an error
Fatal error: Uncaught RuntimeException: A facade root has not been set
But at the same time, if I make a request as follows
$result = User::get();
I get all records from db without error (Moreover, the User class is redefined and extended from the Model class, that is, this is not the class described in your library)
How to fix this? Because I need to use custom queries via DB::statement ()