The missing laravel helper that allows you to ispect your eloquent queries with it's bind parameters
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 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.
You can install the package via composer:
composer require mouadziani/laravel-query-inspector
// Using toSql()
$query = Model::where('attribute', 'value')->toSql();
dd($query); // select * from models where attribute = ?
// Using toRawSql()
$query = Model::where('attribute', 'value')->toRawSql();
dd($query); // select * from models where attribute = 'value'
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
featured_repository