mercredi 6 novembre 2019

Why I received a Null return after a getKey() method in Laravel

I have a database a model of BranchSummaryReport and on this entity,

I put a protected $primaryKey = 'product_id';. But if you'll go to the table of branch_summary_report you'll see that this 'primary_id' column on branch_summary_report is not a primary_key. And 'product_id' has a repeating data (row 1 and 2 has a product_id of 1 but different branch_id).

When I use this getKey() method, I received a Null instead of I'll be receiving it's product_id(s) of certain row. I don't know if because this getKey method is not supported multiple ids.

Thanks, I'm new to laravel.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire