title: when retrieving json data from the json column type in mysql 5.7 using laravel 5.2 getting error
body: <p>Iam usin mysql 5.7,laravel5.2 and php 5.6.17 in my application..</p>
  
  <p>I created a migration table</p>
  
  <pre><code>   public function up()
      {
          Schema::create('admin_login_history', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('url');
              $table-&gt;json('client_details');
              $table-&gt;integer('user_id')-&gt;nullable();
              $table-&gt;timestamps();
          });
      }
  </code></pre>
  
  <p>I created a model for it..</p>
  
  <pre><code>class AdminLoginHistory extends Model
  {
  
      protected $table = 'admin_login_history';
  
      protected $fillable = ['file_path', 'url', 'user_id', 'client_details'];
  
      protected $casts = ['client_details' =&gt; 'json'];
  }
  </code></pre>
  
  <p>Iam inserting a array of data of client_details which is converted to json  in  my model.</p>
  
  <p>now when retrieving the data from the table iam getting error</p>
  
  <pre><code>$loginhistory = AdminLoginHistory::where('user_id', $id)-&gt;orderBy('created_at', 'desc')-&gt;take(3)-&gt;get();
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>File Path: /home/storage/elivio/InvizoAdmin/vendor/laravel/framework/src/Illuminate/Database/Connection.php
  Error Code:HY000,  Line Number:669
  Message:SQLSTATE[HY000]: General error: 2036 (SQL: select * from `admin_login_history` where `user_id` = 1 order by `created_at` desc limit 3)
  </code></pre>