Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

That's not a good way (comma separated values) to store data in the DB, as you're now discovering. In addition to being extremely hard to get data, it is next to impossible to accurately query it. You need to separate the relationships into separate tables:

characters -id -name

titles -id -name

character_title -character_id -title_id

Table character_title holds the many-to-many relationships between characters and titles. Then you simply setup your Laravel models following the examples at http://laravel.com/docs/eloquent#many-to-many.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

khaccounts khaccounts Joined 21 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.

© 2024 Laravel.io - All rights reserved.