I request help me with this situation, I am trying to show a form to edit it but the idrol field returns an object, how can I access it to show me the user's role correctly
Without using the fill method, I can access the property as follows
this.idrol =data['roles'][0].id it shows the role,
but in this way I would not be taking advantage of the benefits of the vform package
Edit Method
editModal(user){
console.log(user);
let me =this;
me.form.reset();
me.form.clear();
me.modal=1;
me.tipoAccion =2;
me.form.fill(user);
},
My Controller
public function index(Request $request)
{
if (!$request->ajax())
return redirect('/');
$name = $request->get('name'); //Captura el dato ingreso en el campo name
$users = User::search($name)->with('roles')->orderBy('id','DESC')->paginate(10);
//$userRole = $user->roles->pluck('name','name')->all();
return [
'pagination' => [
'total' => $users->total(),
'current_page' => $users->currentPage(),
'per_page' => $users->perPage(),
'last_page' => $users->lastPage(),
'from' => $users->firstItem(),
'to' => $users->lastItem(),
],
'users' => $users
];
}
Hi,
I request help me with this situation, I am trying to show a form to edit it but the idrol field returns an object, how can I access it to show me the user's role correctly
Without using the fill method, I can access the property as follows
this.idrol =data['roles'][0].id
it shows the role, but in this way I would not be taking advantage of the benefits of the vform packageEdit Method
My Controller
I appreciate your help