php - Laravel 5 belongsToMany() on custom tableGet the solution ↓↓↓
Have you set the primary key on your "userrole" model?
Laravel automatically assume that you're primary key is named
See this: http://laravel.com/docs/5.1/eloquent
Take a look at the primary key section:
Eloquent will also assume that each table has a primary key column named
id. You may define a
$primaryKeyproperty to override this convention.
Try to override it at your
userrole model like so:
protected $primaryKey = 'roleId';
Try to read all the doccumentattion carefully.
Share solution ↓
Link To Answer People are also looking for solutions of the problem: warning: a non-numeric value encountered in
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.