Back

Does anyone use Laravel Pennant to store user settings? For example, I have a multi-tenant app and a user can belong to multiple tenants. I want to store which tenant is currently the user's active tenant. Does that make sense or is that best left out of Pennant?

1

172

In response to @skegel

I'd advise against this. Pennant's data is really only a cache of the current state of its rules and can be purged.

For your case I'd recommend a simple foreignId on your users table such as current_tenant_id

2

361

In response to @simonhamp

That’s what I was worried about. Thanks for the response! I was also thinking about adding it as a pivot value on the tenant _user table. I try to keep the user table from getting too many extra columns. I could be overthinking it in the case though.

1

189

In response to @simonhamp

The pivot would have a `is_current` field on it so you would look for tenants for the user with `is_current` set. However, that requires the extra work of deselecting the previous one. Though, maybe that’s solved by using a timestamp instead.

1

136

In response to @skegel

Sounds over-engineered. A simple foreignId on the users table would see this done clearly and concisely

379

  • No matching results...
  • Searching...

/ 1000