-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generator plural detection error fails on special words like staff #9
Comments
using any of the below variation of the word Staff has the same issue MyStaff |
Just wondering if this is a side effect of string conversion to singular & Camel case etc used bu L5BCrud? |
Further research brings up https://stillat.com/blog/2017/12/06/laravel-5-string-helpers-pluralization-and-strings which say the word staff is a special case. I still don't know enough to fix / by pass this issue. |
Actually it turns out that MyStuff, AllStaff & BlaStaff works. I did not know that the route becomes |
here is the result of generating the crud for staff
|
I think I have managed to by pass the issue. In the Doctrine Inflector package Inflectror.php I removed the word 'staff' from the $uninflected array. then I can do php artisan l5b:crud staff -m Then access the create new item by http://l5b.test/admin/staffs/create It then works no issues! |
So looks like L5B Crud is choking on generating CRUD that has 'special words' ?? |
Hi @360col and thanks for opening this issue and solving it! Since this is how the plural method works I will include a warning in the readme file pointing to the post in Stillat blog. I don't know if modifying the inflector package is a good idea, do you think I should mention this workaround? |
A note should be added so people don't bang their heads for days like I did. People can choose to modify the inflector package or not. One can modify the inflector package. Generate the Crud. Then change it back. Then there would be no side effect except during that short windows they need to generate the initial L5b Crud. Also the change would get wipe out next time the inflector package gets updated. |
I used below command to generate a new CRUD base on the Example.
php artisan l5b:crud Staff -m
I then try to access the new CRUD using below
http://l5b.test/admin/staff and try adding a new staff
It crashed with:
` ErrorException (E_ERROR)
Call to undefined method App\Models\Staff::links() (View: C:\xxx\www\l5b\resources\views\backend\staff\index.blade.php)
Previous exceptions
`
using any other words seems to work ok. Looks like somehow it is falling over with the plural detection of words like these.
using http://l5b.test/admin/staffs I get an error 404 not found.
http://l5b.test/admin/examples works no issues.
Other words / CRUD like below works no issues:
php artisan l5b:crud Someones -m
php artisan l5b:crud person -m
php artisan -v Laravel Framework 5.8.8
How can I bypass this issue?
Thanks.
The text was updated successfully, but these errors were encountered: