Laravel not updating null values to foreign key column

  laravel, mysql, php

I have a problem with laravel when I try to update the record and add it’s foreign key to NULL
it didn’t update at all.

there is no error appears and i check the Mass Assignment to

Migration File

Schema::create('time_slots', function (Blueprint $table) {
   $table->enum('duration', ['30', '60']);
   $table->double('price', 6, 2)->nullable();;
   $table->enum('currency', ['usd', 'egp'])->nullable();
   $table->enum('status', ['available', 'booked', 'finished'])->default('available');
   $table->enum('type', ['video', 'text', 'phone', 'not-set'])->default('not-set');

Update Query

 $timeslot->currency = null;
 $timeslot->price = null;
 $timeslot->patient_id = null;
 $timeslot->status = 'available'; // that is the only culomn that update correctly

Source: Laravel

Leave a Reply