You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This does not implement route model binding, which is a sane default in any project with policies. For example, this pattern is required if the developer wishes to implement policies via middleware or via controller helpers.
My suggestion is to generate code similar to this:
This returns identical results, while helping implement policies out of the box.
The caveat is that it's not a sane default when using the repository pattern, so this should only apply when that option is set to false.
The text was updated successfully, but these errors were encountered:
Mosaab-Emam
changed the title
[Feature Request] Implement route-model binding by default
[Feature] Implement route-model binding by default
Dec 21, 2022
Assuming
laravel_generator.php
:And assuming we are generating a model named
Post
, here's what gets generated inPostController.php
:This does not implement route model binding, which is a sane default in any project with policies. For example, this pattern is required if the developer wishes to implement policies via middleware or via controller helpers.
My suggestion is to generate code similar to this:
This returns identical results, while helping implement policies out of the box.
The caveat is that it's not a sane default when using the repository pattern, so this should only apply when that option is set to false.
The text was updated successfully, but these errors were encountered: