Laravel-Challenge-Route-Model-Binding
Laravel-Challenge-Route-Model-Binding copied to clipboard
#1, #2 and #3 done
Honestly #2 is something that annoys me with laravel, it can open so many ways of mistakes undetected by IDE and tools (that i know of). I feel like those sort of things should be cought by some semantic checker. Or rather, it has to made more clear in the route probably that this is supposed to be a model binding. (see #3 for example)
I mean #1 get's outlined by hopefully most IDEs.
For #3 i guess would be harder but i guess with a syntax like this, it might be easier to catch for tools and humans:
Route::get(['transactions', '{transaction}', 'duplicate'],
[TransactionController::class, 'duplicate'])
->where('transaction', [App\Model\Transaction::class, 'uuid'])
->name('transactions.duplicate');
Just like the improvement from Route::get('x', 'MyController@x')
to Rouge::get('x',[MyController::class, 'x']
EDIT: Whoops i didn't notice #1, #2 and #3 would link to other pull-requests, they are supposed to refer to the task numbers :D