Laravel Query Inspector
The missing laravel helper that allows you to ispect your eloquent queries with it's bind parameters
Motivations
Let's say you want to get the generated sql query from an eloquent query, by default in Laravel you can use the toSql()
method, but in some situations you may need to get the generated query with its values instead of just getting the prepared statement, in this case you can use this package as well as a helper that which will give you the generated sql query with its bind parameters as a plain sql query just by calling toRawSql()
from any eloquent query.
Installation
You can install the package via composer:
composer require mouadziani/laravel-query-inspector
Usage
// Uisng toSql()
$query = Model::where('attribute', 'value')->toSql();
dd($query); // select * from models where attribute = ?
// Uisng toRawSql()
$query = Model::where('attribute', 'value')->toRawSql();
dd($query); // select * from models where attribute = 'value'
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.