Skip to content
Advertisement

I have a problem with my laravel query builder

I’m using laravel as my web project, and I have an issue when I update my database.

I have an error message on my postman after posting data. Here is the message.

JavaScript

This is my function code to update a row on a database.

JavaScript

I don’t know what’s going on with my code, i search for ‘transact_id’ on my query builder, but the error message shows that I search for ‘id’. It’s odd. Any solution for my problem?

Edit: This is my table structure. https://imgur.com/gallery/s5Ltmek

Advertisement

Answer

My suggestion is to set your primary key in the model like protected $primaryKey = 'transact_id' because laravel assumes id as primary key by default.

Check this reference for more info on laravel and primary keys.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement