title: Retrieving old Check-box array
body: <p>I have a checkbox array that has its values stored as JSON in a database, I want to get the old value or the stored value in the database. here is the code I wrote.</p>
  
  <p>It did not work as I expected, is there a best practice to deal with this issue?</p>
  
  <pre><code>&lt;?php $savedDevices = json_decode(Auth::user()-&gt;devices, true);?&gt;
  &lt;input type="checkbox" name="devices[Android Phone]" value="1" {{(old('devices') !== null &amp;&amp; array_key_exists("Android Tablet", old('devices')) ||array_key_exists("Android Tablet", $savedDevices) )?"checked":""}}&gt; Android Phone &lt;/label&gt;
  &lt;input type="checkbox" name="devices[Android Tablet]" value="1"  {{(old('devices') !== null &amp;&amp; array_key_exists("Android Tablet", old('devices')) ||array_key_exists("Android Tablet", $savedDevices) )?"checked":""}}&gt; Android Tablet &lt;/label&gt;
  &lt;input type="checkbox" name="devices[iPhone]" value="1" {{(old('devices') !== null &amp;&amp; array_key_exists("iPhone", old('devices')) ||array_key_exists("iPhone", $savedDevices) )?"checked":""}}&gt; iPhone &lt;/label&gt;
  &lt;input type="checkbox" name="devices[iPad]" value="1" {{(old('devices') !== null &amp;&amp; array_key_exists("iPad", old('devices')) ||array_key_exists("iPad", $savedDevices) )?"checked":""}}&gt; iPad &lt;/label&gt;
  </code></pre>