title: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'image' cannot be null
body: <p>I am struggling with my working on a upload a file that was made out of Laravel. I had followed some tutorials on youtube but I can seem to expand the toggle button when the screen size is reduced to the smallest. Since I'm starting a new project, I applied all of this with Laravel and opened the edit.blade.php file in my local directory. Please help me! I have been stuck for hours.</p>
  <p>migration</p>
  <pre><code>public function up()
  {
      Schema::create('slide_shows', function (Blueprint $table) {
          $table-&gt;id();
          $table-&gt;bigInteger('user_id')-&gt;unsigned();
          $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users')-&gt;onDelete('cascade');
          $table-&gt;string('image');
          $table-&gt;string('lang');
          $table-&gt;timestamps();
      });
  }
  </code></pre>
  <p>SlideShow.php</p>
  <pre><code>protected $fillable = [
      'user_id',
      'lang',
      'image'
  ];
  </code></pre>
  <p>web.php</p>
  <pre><code>Route::resource('slideShows', 'SlideShowController')
  
  public function update(SlideShowRequest $request, SlideShow $slideShow)
  {
      if ($request-&gt;hasFile('image'))
      {
          $file = $request-&gt;file('image');
          $name = time();
          $extension = $file-&gt;getClientOriginalExtension();
          $fileName = $name . '.' . $extension;
          $file-&gt;move(public_path('images/slideShows'), $fileName);
      }
      $data = [
          'user_id' =&gt; 1, //auth()-&gt;id(),
          'image' =&gt; $fileName ?? null,
          'lang' =&gt; $request-&gt;lang
      ];
      $slideShow-&gt;update($data);
      return redirect()-&gt;route('groups.index');
  }
  </code></pre>
  <p>edit.blade.php</p>
  <pre><code>    &lt;form action=&quot;{{ route('slideShows.update', $slideShow-&gt;id) }}&quot; method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&gt;
          @csrf
          @method('PUT')
          &lt;div lang=&quot;row&quot;&gt;
              &lt;div class=&quot;col-md-6&quot;&gt;
                  &lt;div class=&quot;form-group&quot;&gt;
                      &lt;label for=&quot;lang&quot;&gt;lang&lt;/label&gt;
                      &lt;select id=&quot;lang&quot; name=&quot;lang&quot; class=&quot;form-control&quot;&gt;
                          &lt;option value=&quot;fa&quot; {{ $slideShow-&gt;lang == 'fa' ? 'selected' : '' }}&gt;fa&lt;/option&gt;
                          &lt;option value=&quot;ar&quot; {{ $slideShow-&gt;lang == 'ar' ? 'selected' : '' }}&gt;ar&lt;/option&gt;
                          &lt;option value=&quot;en&quot; {{ $slideShow-&gt;lang == 'en' ? 'selected' : '' }}&gt;en&lt;/option&gt;
                      &lt;/select&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-6&quot;&gt;
                  &lt;div class=&quot;form-group&quot;&gt;
                      &lt;label for=&quot;image&quot;&gt;image&lt;/label&gt;
                      &lt;input type=&quot;hidden&quot; name=&quot;image&quot; value=&quot;{{ $slideShow-&gt;image == $slideShow-&gt;image ? $slideShow-&gt;image : '' }}&quot;&gt;
                      &lt;input id=&quot;image&quot; type=&quot;file&quot; name=&quot;image&quot; class=&quot;form-control&quot;&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;col-md-4&quot;&gt;
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;button type=&quot;submit&quot; class=&quot;btn btn-success&quot;&gt;save&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  <p>I see this error</p>
  <blockquote>
  <p>SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'image' cannot be null (SQL: update <code>slide_shows</code> set <code>image</code> = ?, <code>slide_shows</code>.<code>updated_at</code> = 2021-01-22 15:53:49 where <code>id</code> = 1)</p>
  </blockquote>