PHP code example of morrislaptop / laravel-query-builder-dump

1. Go to this page and download the library: Download morrislaptop/laravel-query-builder-dump library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

morrislaptop / laravel-query-builder-dump example snippets


$users = DB::table('users')
           ->select('name', 'email as user_email')
           ->join('contacts', 'users.id', '=', 'contacts.user_id')
           ->union($first)
           ->dump()
           ->where('something', 'true')
           ->orWhere('name', 'John')
           ->orderBy('name', 'desc')
           ->groupBy('account_id')
           ->dump()
           ->offset(10)
           ->limit(5)
           ->having('account_id', '>', 100)
           ->get();
 php
array:3 [
  "bindings" => array:6 [
    "select" => []
    "join" => []
    "where" => array:1 [
      0 => Illuminate\Support\Carbon {#736
        +"date": "2017-11-24 15:10:26.000000"
        +"timezone_type": 3
        +"timezone": "UTC"
      }
    ]
    "having" => []
    "order" => []
    "union" => []
  ]
  "sql" => "select * from `prizes` where `comment_id` is null and `release_at` < ? order by `release_at` asc"
  "raw" => "select * from `prizes` where `comment_id` is null and `release_at` < '2017-11-24 15:10:26' order by `release_at` asc"
]