Skip to content

練習寫 Composer Package;這用來使用在 Laravel 上,想要得到完整的 SQL,並直接使用其結果去 Database 上做個查詢。

License

Notifications You must be signed in to change notification settings

XasonLai/query-builder-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QueryBuilderHelper

QueryBuilderHelper is a PHP package designed to work with Laravel's Eloquent query builder. It provides a convenient way to get the raw SQL query along with its bindings, which can be useful for debugging and logging.

Installation

You can install the package via composer:

composer require guagualai/query-builder-helper

Usage

Here's a simple example of how to use QueryBuilderHelper:

use Guagualai\QueryBuilderHelper\SqlHelper;
use Illuminate\Database\Eloquent\Model;

class YourModel extends Model
{
    // Your model's methods...
}

$query = YourModel::where('column', 'value')->getQuery();
$sqlWithBindings = SqlHelper::getWithBindings($query);

echo $sqlWithBindings;

This will output the raw SQL query with the bindings included, making it easier to see the actual query that will be run against the database.

License

The MIT License (MIT). Please see License File for more information.

About

練習寫 Composer Package;這用來使用在 Laravel 上,想要得到完整的 SQL,並直接使用其結果去 Database 上做個查詢。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages