Mmh yeah, in general, this should work. Did you set the fillable fields on the model? Laravel needs some way to map these fields I guess.
Laravel - Create an Empty Eloquent Model and send as JSON?
I'm using InertiaJS and I'm basing my project scaffold as a bit of a cross between the demo PingCRM app (https://github.com/inertiajs/pingcrm) and an example application Sebastian De Deyne gave at Laracon (https://github.com/sebastiandedeyne/laracon-eu-2019-inertia-demo-app/)
The issue I'm having is I'm trying to replicate this code here in my own project; https://github.com/sebastiandedeyne/laracon-eu-2019-inertia-demo-app/blob/master/app/Http/Controllers/PostsController.php#L42
But the issue is, when I try and perform this code myself such as; 'model' => new Model() it just returns an empty array, where as ideally I'd want it to return all fillable attributes on the model as just empty strings or null or something similar.
Inside his demo it works, so I'm not sure what could be causing this as I can't really seem to find any differences between our projects at the moment.
Hopefully someone can help.
Please or to participate in this conversation.