Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eloquent - Store serialized arrays in database - Method overwriting

So I have a model user in my database that has a column containing a serialized string contact.

My question is: is it possible to ovewrite the method getContactAttribute in order to directly output unserialized data?

like image 491
repptilia Avatar asked Nov 27 '25 17:11

repptilia


1 Answers

Yes this is totally possible, check this section of documentation:

Laravel 4.2 Docs Accessors and Mutators

like image 114
ewooycom Avatar answered Nov 29 '25 08:11

ewooycom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!