if I have an Eloquent Model called Post, and the mysql table has:
integer ID, string Text
How do I convert this JSon:
{ post: { text: \'my text\'
It's way simple as like followings:
$json_post = { "post": { "text": "my text" } }; $post = new Post( json_decode($json_post, true) );
Now, you can run all eloquent methods on the most $post, ex:
$post->save()
I tested with laravel v7.11.0