Thursday, March 30, 2017

Getting another table's string via id

I have two tables

Since I can't format them here, check the imgur link

img

The wildcard roles includes strings like department.* or blogger.department.*

I'm trying to create an inheritance system but i'm stuck on creating a many-to-many relationship

Since "wildcards" aren't a model, I can't use eloquent from what i've gathered. So I think I have to use the DB facade...

Here's what I need

  1. Get the role ID (eg: admin = 1)
  2. Get all wildcard_roles from the table role_wildcards by the ID
  3. Return a collection of all the wildcard strings

Notes

It doesn't have to use eloquent, it can use the DB facade



via Albert

Advertisement