jeudi 30 août 2018

What is the difference between attributesToArray() and toArray() in Laravel?

Can someone explain the difference between $model->attributesToArray() and $model->toArray() on a model?

I have an issue where a seeder is throwing an error about getCreatedAtAttribute method is not defined and it's complaining due to a toArray() method call. This is what prompted me to try and find out the difference between the two.

After switching to attributesToArray() the seeder runs fine.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2PgmDyf
via IFTTT

Aucun commentaire:

Enregistrer un commentaire