i think you need to write nullable() befor constrianed('tabel name') example $table-> foreignId (' parent_id') -> nullable ( ) -> constrained ('categories','id') -> nullOnDelete ()
$table-> foreignId (' parent_id') -> nullable ( ) -> constrained ('categories','id') -> nullOnDelete ()