title: Laravel getting an "Array to string conversion" while storing an Array into a Json database field
body: <p>I'm trying to save an array with options into a json datafield of my postgres database. I'm working with Laravel 5.5 and I'm using the extension "dimsav/laravel-translatable" for translations.</p>
  
  <p>My model Question looks like this:
  namespace App;</p>
  
  <pre><code>use Illuminate\Database\Eloquent\Model;
  use Dimsav\Translatable\Translatable;
  
  class Question extends Model
  {
      use Translatable;
      public $translatedAttributes = ['options', 'answer'];
  
      protected $casts = [
          'options' =&gt; 'array'
      ];
  }
  </code></pre>
  
  <p>The model QuestionTranslation looks like this:</p>
  
  <pre><code>namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class QuestionTranslation extends Model
  {
  
  public $timestamps = false;
  public $fillable = ['options', 'answer'];
  </code></pre>
  
  <p>}</p>
  
  <p>And the store action in the QuestionsController:</p>
  
  <pre><code> public function store(Request $request)
  {
      $question = new Question();
  
      $options[1] = "test1";
      $options[2] = "test2";
  
      $question-&gt;answer = 1;
      $question-&gt;options = $options;
  
      $question-&gt;save();
  
  }
  </code></pre>
  
  <p>When I try to store that data I get the error:</p>
  
  <pre><code>Illuminate \ Database \ QueryException
  Array to string conversion (SQL: insert into "question_translations" ("locale", "answer", "options", "question_id") values (en, 1, test1, 18) returning "id")
  </code></pre>
  
  <p>When I use <code>json_encode</code> to cast $options myself, I can store it without problems. </p>
  
  <p>Do you have any idea, why the laravel casting is not working? Maybe because of the translatable extension?</p>