I am trying to use DB class to run query. I have used it in my controller like this:
use \DB;
And I am using it in my code like this:
$changeCar = DB::select(DB::raw($query));
I have tried including it like this:
use Illuminate\Support\Facades\DB
But still the same. Also, tried it with the backslash in the code and not including it like this:
$changeCar = \DB::select(\DB::raw($query));
My Code:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use \DB;
class TicketsController extends Controller
{
public function myTickets()
{
$user = Auth::user();
$changeCar = DB::select(DB::raw($query));
}
}
Still the same. What am I doing wrong here? Any help?
P.S: My laravel version is 5.4.33