1

I want to add a column which is an array or json type by the default it should be an empty if i am not passing any value ,and it should take a value (if i pass any value it should take a value otherwise it should take empty/null value automatically).How to acheive this thing ...?

 $table->json('collabMail',['null','sai'])->default(null);

i am writing like this but it's not working

i am trying one more way like this $table->json('collabMail')->default(null)->change(); it's migrating the table but collabMail column is not reflected in my database

Code cracker
  • 316
  • 1
  • 5
  • 20

1 Answers1

1

You can make it nullable() and also don't forget to cast in your model

protected $casts = ['collabMail' => 'array'];