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

1 Answer 1

1

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

protected $casts = ['collabMail' => 'array'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.