Per the documentation we can do something like this to run a raw query :
use Illuminate\Support\Facades\DB;
DB::select('select * from users where id = :id', ['id' => 1]);
But I couldn't find a way in the documentation to initialize eloquent with my database in order to execute that query.
I'm using PHP 7.3 (no frameworks) to work with eloquent. Where can I initialize the database to eloquent?
I've found in the doc ways to do so using the \Capsule\Manager
as seen in the readme in this link, but no way to use this while getting the Db::select
to work, any idea on how to properly configure this?
I'm looking for something like this maybe ?
DB::init([
'driver' => 'mysql',
'database' => 'database',
'username' => 'root',
'password' => ''
])