In laravel8/inertia/vue3 app creating model I set mode of the form in “add” mode and I try when new model is created return it in responce , like :
$role = Role::create([ 'name' => $request->name, 'guard_name' => 'web', ]);
return back ()->with('data', [
'role' => $role,
]);
But I can not get this new model on client part with code :
this.form.post(this.route('admin.roles.store'), {
preserveScroll: true,
onSuccess: (resp) => {
console.log('resp::')
console.log(resp)
Toast.fire({
icon: 'success',
title: 'New role created!'
})
},
In browser I do not see model returned from control : https://prnt.sc/1xxhS-EOHLSh
How can I do this ?
Thanks!