the Store Function in PostController doesn't save content
mehdiyaq opened this issue · 0 comments
mehdiyaq commented
migration:
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
model:
use HasTrixRichText;
protected $guarded = ['id'];
View:
<form action="{{ route('trix.store') }}" method="post">
@csrf
<div class="my-5" >
@trix(\App\Post::class, 'content')
<button type="submit">submit</button>
</div>
</form>
store funnction:
public function store()
{
Post::create([
'post-trixFields' => request('post-trixFields'),
'attachment-post-trixFields' => request('attachment-post-trixFields')
]);
}
by:
dd(\request()->all());
I get:
array:3 [▼
"_token" => "Ylm6lC0HBCdmRvvb9P2sCZ5uPoaZl16k7vMmg5qc"
"post-trixFields" => array:1 [▼
"content" => "
test
"]
"attachment-post-trixFields" => array:1 [▼
"content" => "[]"
]
]
the attachment will save but nothing save in trix_rich_texts