Reputation: 4189
Im trying to migrate our current application over to Laravel-5.
This app has quite a big structure with many tables, but way less than half of the tables has a primary key
called id
.
Is this a problem or can you manualy specify what you want your primary key to be called.
Its just that from the training videos I am doing, it seems like no.
Upvotes: 3
Views: 5047
Reputation: 479
$table->string('your_primary_key', 32)->primary();
'your_primary_key' is the name's primary key
32 is length
I try and it work
Upvotes: 0
Reputation: 7814
You can use
protected $primaryKey = 'Your_Primary_key';
In the Models.
Upvotes: 8
Reputation: 2178
Sure, just add $table->primary('field')
to your database shema as mentioned here: http://laravel.com/docs/5.0/schema#adding-indexes
Upvotes: 1