Reputation: 377
I am developing an application in Laravel 5.2.27
. I have setup a model where primary key is other than id
and I have defined primary key in my model by using:
protected $primaryKey = 'district_code';
When fetching the records the value of district code is displayed something else, different than that of record stored in database. But when I remove the line protected $primaryKey = 'district_code';
everything works fine.
Upvotes: 2
Views: 1711
Reputation: 5135
can you show/add your Table structure and Records which you are fetching?
another thing, did you defined table name in your model? eg like this.
protected $table = 'doseage_form';
Upvotes: 0