Laravel Community Tools by Tighten

Category "Debugging" tricks

36 tricks
It's a bit tricky to figure out exactly where to put a breakpoint to quickly check your final sql statement before execution. This is for 4.2 but may be similar in
sgelbart 9 years ago 12045
Don't forget to add the `DATABASE_QUERIES_DEBUG` in the .env file. Call this function `$this->debugDatabaseQueries()` from any service provider `register` function:
Mahmoudz 9 years ago 7070
Bumped into a problem while trying to authorize user against laravel basic auth middleware when testing a REST API through phpunit. I used phpunit call method to send a POST request to API's endpoint which needed users basic HTTP authentication. Every time, laravels basic auth middleware rejected it and I had no idea why, since I've sent proper HTTP Authorization header with phpunit call. Here is the solution ! Or watch it in a video https://www.youtube.com/watch?v=LCrt7jqDsgU Read more on http://laravel.io/forum/03-20-2014-authbasic-fails
Novica89 10 years ago 15962
You can see SQL Query of your DB table on Laravel App, by Event listener.
ahaneef29 10 years ago 8234
A couple of view creators that inject variables or text into views
davestewar... 10 years ago 7218
In Laravel 5, by default you have CSRF in every single POST. If you are new to Laravel and you use the usual HTML code to create inputs and forms then you will definitely encounter that error. Also, if you are coming from Laravel 4, again you might not know how to solve this error since 'Illuminate\Html\HtmlServiceProvider' is not installed by default anymore and HTML inputs and form have to be used. There are 3 solutions in order to fix it. 1) If you want to keep the usual HTML code and not use 'Illuminate\Html\HtmlServiceProvider' (since it is not installed by default in Laravel 5), then you can delete this line of code '\App\Http\Middleware\VerifyCsrfToken::class,' in app/Http/Kernel.php. However this is not a good practice. You can still do that though, in case you are building something small or an API. 2) You can install 'Illuminate\Html\HtmlServiceProvider' and do it the old good Laravel 4 way, which uses tokens by default, thus you don't have to worry about it anymore. 3) The last solution is in case you want to code the front end with the usual HTML code then you can use this line in your layout or in case you don't have a layout then in every single page. <input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}" /> You can get Laravel 5 tutorials and projects for all levels (Beginners-Intermediate-Advanced) in this website www.codeexecutable.com/courses
codeexecut... 10 years ago 9796
replace this in the start/global.php file:
Mahmoudz 10 years ago 7657
1 . remove the Laravel4 module from the functional.suite.yml 2. codeception build 3. inside the FunctionalHelper, do extend the \Codeception\Module\Laravel4 4. and there add your extra Laravel functions.
Mahmoudz 10 years ago 6145
If you are using Web Developer Extension in Firefox (or similar), you can enable the debug mode creating a cookie. Just create a cookie called 'debug' with value '1', and path '/', then open up your app.php and edit the debug option with the following:
davidmoral... 10 years ago 7132