CRUD
CRUD copied to clipboard
Morphto v2 - with ajax support
WHY
BEFORE - What was wrong? What was happening before this PR?
Before everything ... PFEEEWWWW! 😫 done!
AFTER - What is happening after this PR?
This is a re-implementation of #4330 but with support for ajax fields and a new syntax.
There are examples of both usages (array and fluent) in the demo branch https://github.com/Laravel-Backpack/demo/pull/388 . fluent implemented, array documented.
PRO pr is also updated: https://github.com/Laravel-Backpack/PRO/pull/18
@tabacitu can you give a round up on usability and let me know how we are here?
The only thing that I notice about usability is that the error messages are duplicated, in "morphTo" container field and the actual field:
Just need to discuss with you which one you think we should keep.
This was a wild wild ride! sooooooooo many details ... I LOVE it! 🙃
NOTE: not implemented yet CRUD JS API.
We decided to write docs for this in this PR, then try doing MorphToMany too, see how the docs would be different between the two.
Heads up @tabacitu this branch had been updated.
MorphTo fields are now treated as subfields.

I've updated demo and pro PR too. Also added to docs: https://github.com/Laravel-Backpack/docs/pull/368
Hi @pxpm i dont know if i do something wrong. Here we go:
I set my branches as:
PRO: morphTo-relation CRUD: morphto-v2 DEMO: morphto
But when i go to CRUD: admin/pet-shop/comment/create i get 500 error

I get error details and is about memory leak:
2022/09/12 12:15:24 [error] 10#10: *38 FastCGI sent in stderr: "PHP message: PHP Deprecated: Required parameter $options follows optional parameter $label in /var/www/bp_demo_20220803/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Relationships.php on line 429PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/bp_demo_20220803/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 420PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65536 bytes) in /var/www/bp_demo_20220803/vendor/composer/ClassLoader.php on line 571" while reading response header from upstream, client: 172.19.0.1, server: backpack.test, request: "GET /admin/pet-shop/comment/create HTTP/1.1", upstream: "fastcgi://172.19.0.5:9000", host: "backpack.test", referrer: "http://backpack.test/admin/pet-shop/comment"
2022/09/12 12:20:21 [error] 10#10: *40 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/bp_demo_20220803/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 420PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65536 bytes) in /var/www/bp_demo_20220803/vendor/composer/ClassLoader.php on line 571" while reading response header from upstream, client: 172.19.0.1, server: backpack.test, request: "GET /admin/pet-shop/comment/create HTTP/1.1", upstream: "fastcgi://172.19.0.5:9000", host: "backpack.test", referrer: "http://backpack.test/admin/pet-shop/comment"
I have not limit set on PHP.
Cheers.
Hi @pxpm problem was created because monster have more than 500K rows, now is working.
I check implementation, till now look working normal, but i have a commment about error message: "The commentable.commentable id field is required."

To prevent someone need to be force to translate, is possible a message like "The commentable in commentable id field is required." replace "." by "in".
Let me know if this is possible or what you think about it.
ty.
Cheers.
I've change the error message, now it reads: This field is requiried.
I think writting commentable and technical terms here does not help UI.
This is a message for a non-developer user.
Cheers
Hello @pxpm im back :)
Look great for me, now is not needed touch request.

Cheers.
@tabacitu did the changes.
Just one question still un-answered https://github.com/Laravel-Backpack/CRUD/pull/4579#discussion_r992215203
Cheers
OMG PEDRO IT'S HAPPENING!!! 😱
Here's the GIF for it:

Here's the GIF for it:
A gif with a "broken/failing" test doesn't seem very appealing to me @tabacitu 💥