amaelftah/laravel-trix

trix_rich_texts table is not affected

AhmedRamadan30 opened this issue ยท 13 comments

Salam

Thank you for this beautiful package
I got a Confusing problem When I add a post, the trix_rich_texts does not store a new record, it still empty and so I cannot store or show the Irish text content
I will attach every part from code here
1
2
3
4
I hope you reply quickly
Thanks

hey @AhmedRamadan30 so you are facing two problems as follow :

  • first one is the rich text editor isn't shown
  • second one is when storing you find the table is empty
    right ?

Hey! I have the exact same issue. Everything works like a charm except storing into database.

@mhansen-upscale can you show me a screenshot of your Model that uses HasTrixRichText

This is the model

Bildschirmfoto 2020-07-21 um 20 14 38

@mhansen-upscale try to remove $fillable . and use $guarded = [];

great, that worked, thanks. Whats wrong with fillable at this point?

@mhansen-upscale i think nothing wrong . can you try to add content-trixFields to the fillable and check it too

perfect, works as well!

cool . @AhmedRamadan30 i think the fix for your issue is same as approve .

either set $guarded = []; . or add the field to fillable

I tried all solutions,
1 - protected $guarded = [];
2 - protected $fillable = ['title', 'post-trixFields'];
3 - protected $fillable = ['title', 'content-trixFields'];
4 - protected $guarded = [];
protected $fillable = ['title', 'post-trixFields'];
after all, the trix_rich_texts table does not store a new record

@AhmedRamadan30 have you tried to do dd(request()->all()) inside the controller and see how the data look like

Thanks, I found the problem, I typed the model name incorrectly (I typed Event instead of Post) and that's because I made a separated project to test Trix. and in the original project, the model name was "Event"

I face another problem in showing images upload. the images are uploaded successfully and saved in Storage/public
but when I show the whole article, images are not shown. Why its link is Storage/image_name , not Storage/public/image_name?
1
2