Support the ongoing development of Laravel.io →
Database Architecture

I am trying to create an application that would store lots of meta data for a user and the same meta key can be stored more than once. Code given in the old forum at http://forumsarchive.laravel.io/viewtopic.php?id=12052 looks more suitable to my need but then I did not understand the purpose of 'metable_type' field? I wonder if it would store the data type like int, string etc or something else?

Last updated 3 years ago.
0

The metable_type field is used with polymorphic relations, where the Eloquent class name is stored along with the key.

Check out http://laravel.com/docs/eloquent#polymorphic-relations for more.

This enables the link back from the meta table to the linked object, which could be different objects, say Post or Comment, or Category.

Last updated 3 years ago.
0

Thanks @allmyitjason, that seems a great help. I would like to ask whether the above approach should be used in my case - where I would have artists as user and artists can have bio, many audios, videos, images and other fields.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

efst efst Joined 2 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.