Laravel not updating null values to column

Jis*_*had 2 laravel eloquent laravel-5.7

Migration

Schema::create('users', function (Blueprint $table) {
        $table->increments('user_id');
        $table->string('username',50)->unique();
        $table->date('start_date');
        $table->date('end_date')->nullable();
        $table->timestamps();
    });
Run Code Online (Sandbox Code Playgroud)

Here start_date set as column type date and nullable

When running Insert function like below its inserting null values

$insert = [
    'username'  =>strtoupper(request('username')),
    'password'  =>Hash::make(request('password')),
    'start_date'  =>date('Y-m-d',strtotime(request('start_date'))),
  ];
  if(request()->filled('end_date')){
    $insert['end_date'] = date('Y-m-d',strtotime(request('end_date')));
  }
  User::create($insert);
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

When Updating the same row left blank as end_date input,

$user = User::GetWithEncrypted(request('user_id'));
$update ['start_date'] = date('Y-m-d',strtotime(request('start_date')));
if(request()->filled('end_date')){
  $update['end_date'] = date('Y-m-d',strtotime(request('end_date')));
}else{
  $update['end_date'] = 'NULL';
}
$user->update($update);
Run Code Online (Sandbox Code Playgroud)

In Table, it comes like below 在此处输入图片说明

How can I make it NULL like insert function in update? My strict mode is false now, If I make it true it will throw an exception of invalid data for the end_date column.

Har*_*rry 8

尝试更换

}else{
  $update['end_date'] = 'NULL';
}
Run Code Online (Sandbox Code Playgroud)

}else{
  $update['end_date'] = null;
}
Run Code Online (Sandbox Code Playgroud)

'NULL' 是一个字符串,而 null 是真正的 null。