Sergioh Lonet Sergioh Lonet - 7 months ago 61
PHP Question

How I can put composite keys in models in Laravel 5?

I have in my DataBase a table with two primary keys (id and language_id) and I need put it in my models. The default primaryKey in Models (Model.php in Laravel 5) is id, and I want that the primaryKeys will be id and id_language. I tried put it with arrays or a String with ',' but it doesn't work. It says me that the array could not be converted in String.

Please Help.



You can't. Eloquent doesn't support composite primary keys.

Here's a Github issue regarding this.