Can I change Eloquent model primary key.
I want to set primary key for example admin_id instead of \'id\'?
admin_id
I know I can change table name for m
If you are wanting to use a composite key (a string)
You need to make sure you set public $incrementing = false otherwise laravel will cast the field to an Integer, giving 0
public $incrementing = false
0
class User extends Model { protected $primaryKey = 'my_string_key'; public $incrementing = false; }