Q:

How to easily use and access meta attributes in Eloquent - Laravel

I have a 'contents' table like this :  
id title description  

I have another 'meta' table that stores extra fields for my contents :  
id content_id field_name field_vaue  

My question is How can I access MyModel->field_name as if it is in contents table
I know I can use hasMany relation but it's not satisfy my needs.
Thanks

A:

Use Metable extension from this package instead: https://github.com/jarektkaczyk/eloquence
If you want to do it yourself, then check its source - a bit too long to show it here!

