New to Lavarel.
I am trying to debug a controller's method in Laravel, to do so I'm using Tinker (which is based on Psysh).
I added both of these versions to the breakpoint inside the method signup of my MySuperController:
extract(\Psy\Shell::debug(get_defined_vars()));
eval(\Psy\sh());
I've run php artisan tinker
and done the following in the console:
$controller = app()->make('\App\Http\Controllers\Api\V1\MySuperController');
app()->call([$controller, 'signup'], ["param"=>"value"]);
When executing that, Tinker responds with: Illuminate\Validation\ValidationException with message 'The given data was invalid.'
But I never see the code stop on the breakpoint. Did I assume wrongly that I could debug step by step with Tinker?
This answer was based off of user @lagbox's comment. I asked them to make it an answer so I could choose it, but it's been 4 months, so I'm creating it myself so others can quickly see the question has been answered:
User @lagbox mentioned in a comment:
are you using a form request to validate? if so they are resolved and validated before your controller method is called
The comment was spot on. Tmethod was using a custom request class, which extended from api/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php . I added the eval()
within that class and it finally got to the breakpoint.