amaelftah / laravel-trix

Configurable Basecamp Trix Editor (WYSIWYG) delivered to your laravel application
MIT License
526 stars 53 forks source link

trix_rich_texts table is not affected #39

Closed AhmedRamadan30 closed 4 years ago

AhmedRamadan30 commented 4 years ago

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

amaelftah commented 4 years ago

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

mhansen-upscale commented 4 years ago

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

amaelftah commented 4 years ago

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

mhansen-upscale commented 4 years ago

This is the model

Bildschirmfoto 2020-07-21 um 20 14 38
amaelftah commented 4 years ago

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

mhansen-upscale commented 4 years ago

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

amaelftah commented 4 years ago

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

mhansen-upscale commented 4 years ago

perfect, works as well!

amaelftah commented 4 years ago

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

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

AhmedRamadan30 commented 4 years ago

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

amaelftah commented 4 years ago

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

AhmedRamadan30 commented 4 years ago

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"

AhmedRamadan30 commented 4 years ago

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