0

This is not a question but a way i applied to solve the array to string conversion error while saving. Laravel 5.7

When you have a datatype of 'text' in your database schema and you wish to save array values into it. Then you need to add the following to the model

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

then you can continue saving and it wont give any problem.

2
  • Note: the tribes from above is the field whose datatype is text and would be accepting array values Commented Nov 5, 2018 at 10:58
  • 5
    It's great you want to share your knowledge and solutions! You can answer your own questions on StackOverflow but I requires you to ask a properly formed question first, and then answering it as if it would be answering someone else. Just edit your question and add an answer to your own question and you'll be fine. Commented Nov 5, 2018 at 10:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.