Currently testing some of my controllers. I need to pass a user object to my register user controller in the form of JSON. The user object has an attribute "email". This attribute is under the fillable and hidden arrays, since I want it to be fillable but hidden from users who pull down info on this user.
The issue arises when I create a User object using a factory, and convert it to JSON to test my controller. The email attribute is hidden, so it doesn't show up as part of the JSON, and therefore the controller errors out on no email provided. I understand the hidden array is causing this, but I was wondering if there was some kind of override for toJson() that would allow it to make all the user attributes part of the JSON string, just for my testing.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire