Open rafaucau opened 2 months ago
Workaround:
use Dbout\WpOrm\Orm\Database;
Database::getInstance()->raw( 'count + 1' );
Or in a mu-plugin add facade to use DB
:
use Dbout\WpOrm\Orm\Database;
use Illuminate\Container\Container;
use Illuminate\Support\Facades\Facade;
$container = new Container();
$container->instance( 'db', Database::getInstance() );
Facade::setFacadeApplication( $container );
Hi @rafaucau , thank you for reporting this.
The facades are unfortunately not supported by the library since it is a few things that are mainly used by Laravel projects.
I will try to add these facades to the project but I am not sure it is possible since you have to go through the Illuminate container system. Unfortunately, this requires adding dependencies to projects:(
The only solution today is indeed what you propose in your message.
I'm encountering an issue when trying to use
DB::raw
. The error message indicates a problem with the facade root not being set.How can I properly use
DB::raw
in WordPress context to enable raw SQL expressions?