PHP code example of pyaesoneaung / to-raw-sql

1. Go to this page and download the library: Download pyaesoneaung/to-raw-sql 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/ */

    

pyaesoneaung / to-raw-sql example snippets


User::where('votes', '>', 100)
    ->orWhere(function ($query) {
        $query->where('name', 'Abigail')
            ->where('votes', '>', 50);
    })
    ->toRawSql();

// "select * from `users` where `votes` > 100 or (`name` = 'Abigail' and `votes` > 50)"

DB::table('users')
   ->whereBetween('votes', [1, 100])
   ->toRawSql();

// "select * from `users` where `votes` between 1 and 100"