amaelftah / laravel-trix

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

Problem Storing Rich Text Fields and attachments with livewire #62

Open surencool4 opened 3 years ago

surencool4 commented 3 years ago

create.blade.php

{{ __('Save Page') }}
@error('title') {{ $message }} @enderror
{{ url('') }}
@error('slug') {{ $message }} @enderror
@trix(\App\Page::class, 'content')
@error('content') {{ $message }} @enderror
{{ __('Cancel') }} {{ __('Create') }}

Livewire/Page.php public function create() { $this->validate(); $this->post = Page::create($this->modelData()); $this->modalFormVisible = false; $this->reset(); } public function modelData() { return [ 'title' => $this->title, 'slug' => $this->slug, 'content' => $this->content, 'page-trixFields' => request('page-trixFields'),
'attachment-post-trixFields' => request('attachment-post-trixFields') ]; }

asadghazanfary commented 3 years ago

hi @surencool4

problem solved?

If you solve the problem, can you explain it to me?

thanks

Majidkadi commented 3 years ago

Hi, I think you have an error in your code. 'attachment-post-trixFields' => request('attachment-post-trixFields') I guess it should be 'page' like this: 'attachment-page-trixFields' => request('attachment-page-trixFields')