Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent

Hi,

I know that if I can set the value for the $primaryKey protected field in my model in order to tell Laravel what is the model's primary key. This works well if the primary key is just one column in the database table.

What do I need to do if the table has multiple columns which should act as a primary key? How do I tell the model about it?

Thanks

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

nirsharony nirsharony Joined 23 Aug 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.