SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

Solved
vranaaff

May 31st, 2022 04:49 AM

I am getting "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null" while submitting the profile updation form

I have done everything according to devdojo course guidelines but still having the issue

bobbyiliev

May 31st, 2022 04:53 AM

Hello,

Are you changing the image via Voayger directly? This error will occur if the name input filed is left empty, you need to make sure that you define a value in the name input before pressing the save button.

I've just tested this and can confirm that it is working as expected.

Let me know how it goes.

vranaaff

May 31st, 2022 05:27 AM

I am not changing image i am changing name here…

Report
1
bobbyiliev

May 31st, 2022 05:32 AM

Thanks for the clarification. This was not clear in the question, as it is only stated that you are submitting the form without specifying what changes you are making 😉

Just tested this and it works fine too:

wave profile gif

As per the last comment, are you changing the name via Voayger directly? Have you made any changes to the form?

bobbyiliev

May 31st, 2022 05:41 AM

Just a general tip, when asking a question it is important to share as much information as possible. Otherwise, it is hard to provide any help.

For example:

  • Which script are you referring to? Is it Wave or any other one?
  • How did you deploy it? Is it on a local machine or the DigitalOcean App Platform? Are you using Linux/Windows or Mac?
  • Which form exactly are you submitting?
  • Which course did you follow exactly?
  • Have you made any changes to the form?

The more information the better :) otherwise, we are just guessing.

vranaaff

May 31st, 2022 06:40 AM

i am following devdojo's SaaS adv. course and currently at video 6. i am using laravel 9 hosted on xampp on windows 11 i am submitting the profile settings update form

dashboardcontroller.png profilebladephp.pngwebphp.png

bobbyiliev

May 31st, 2022 07:26 AM

I've just tested that too, and it seems to be working fine with the code from day 6:

saas-save.gif

A few things that I could suggest:

  • Make sure to add the validation from that day
  • If you don't have the validation in place, you need to make sure that you specify the name each time
  • If you are still getting the error, try adding a dd($request->name) to see if the payload is present
  • Make sure that your APP_URL in the .env file matches your URL that you are accessing the app with
vranaaff

May 31st, 2022 07:43 AM

hey, i am just new to laravel where do i have to add dd($request->name) and i can't find the validation till 30mins in the video

bobbyiliev

May 31st, 2022 07:47 AM

Best Answer

To get to a specific section of the video you can click on the navigation right below the video:

SaaS adventure video navigation

You can add the dd right in the beginning of the method.

Also, I would suggest downloading the course files and cross checking your code with the code from the files to make sure that you don't have a typo for example.

vranaaff

May 31st, 2022 09:06 AM

hey, i got that problem solved by adding $request->validate but now the issue is that data isn't updating

bobbyiliev

May 31st, 2022 09:24 AM

A few questions:

  • Did you add the dd statement in the beginning of the method to see if you get any data in the request?
  • Did you make sure that your APP_URL in the .env file matches your URL that you are accessing the app with?
  • Did you try to compare your code with the source code from day 6?
vranaaff

May 31st, 2022 09:32 AM

its working now thanks for your immense support that i will never forget i just compared my dashboard controller with the source code from day 6 and i got the nerve of the error

Report
1
bobbyiliev

May 31st, 2022 10:17 AM

That is great! Happy to hear that I was able to help!

Good luck with your project!

Btw, what was the issue at the end? Was it a typo or a bigger problem?

vranaaff

May 31st, 2022 10:25 AM

basic validation and typo error

bobbyiliev

May 31st, 2022 11:33 AM

Thanks! Happy to hear that it is all working now!

Report
1