Relative Content

Tag Archive for phpmysqllaraveleloquent

How to properly use composite keys as the primary key in Laravel with Spatie Roles and Permissions package?

I need to use both email and phone_number as the primary key for the User model in my Laravel application. Since Laravel doesn’t natively support composite primary keys, I found a workaround to implement it. However, I’m facing issues with relationships, especially when using the Spatie Roles and Permissions package. Specifically, I’m getting an “Array to string conversion” error. Also facing issue on auth()->user() helper function which is returning unexpected result.