select count('vehicules.id') from vehicules INNER JOIN (equipements, contenirs) ON (contenirs.vehicule_id = vehicules.id AND contenirs.equipement_id = equipements.id) WHERE(vehicules.KMActuel-contenirs.dernierKM > equipements.kilometrageMax);
This is the code I want to execute in Laravel. I tried the following code:
$special = DB::select("SELECT COUNT('vehicules.id') FROM vehicules INNER JOIN (equipements, contenirs) ON (contenirs.vehicule_id = vehicules.id AND contenirs.equipement_id = equipements.id) WHERE(vehicules.KMActuel-contenirs.dernierKM > equipements.kilometrageMax)");
I called a variable in the view and got the following error:
htmlspecialchars() expects parameter 1 to be string, array given (View: C:\laragon\www\GSMV\resources\views\dash.blade.php)
You cannot execute expressions in strings passed to regular Eloquent methods. You must use a primitive expression that can be parsed accordingly: