Search code examples
laraveleloquentlaravel-7

How to run normal query in Laravel 7, not using Eloquent


Sometime, I can make can use Eloquent for complex login in laravel. So, i need run a big raw query. How to do that? Example: i need run

Insert Into ..............
       Select..............
       Join....
       Join....
       Where...............
       ...............................................................

Solution

  • May be you're finding for this solution. you can using it for resolve your problem.

    $yourComplexQuery = "
        Insert Into ..............
        Select..............
        Join....
        Join....
        Where...............
       ...............................................................
    ";
    DB::select($yourComplexQuery);