title: How to check if object key exists and is not null or if it is a certain value in a foreach loop in Laravel blade?
body: <p>I have a <strong>foreach</strong> loop in <strong>blade</strong> where I am looping through an <strong>array of items</strong>, and some items has an additional key called <strong>validation_status</strong> which is either <strong>null</strong> or an <strong>object.</strong></p>
  
  <p>An example:</p>
  
  <pre><code>category: "Storage"
  client_id: 6575
  created_at: "2019-08-12 15:50:04"
  created_by: 233
  datasheet: null
  deleted_at: null
  description: "3erty"
  energy_rating: 0
  fk_item_type: 83
  id: 369
  item_model_id: 475
  model_number: null
  power_consumption: 3
  searchable: 1
  shared: 1
  updated_at: "2019-11-09 17:59:04"
  updated_by: 233
  validated: 0
  validation_status: null
  vendor: null
  
  category: "Network"
  client_id: 6575
  created_at: "2019-07-11 16:04:56"
  created_by: 233
  datasheet: null
  deleted_at: null
  description: "2we5"
  energy_rating: 0
  fk_item_type: 83
  id: 357
  item_model_id: 470
  model_number: null
  power_consumption: 55
  searchable: 1
  shared: 1
  updated_at: "2019-11-07 10:29:57"
  updated_by: 233
  validated: 0
  validation_status:
  created_at: "2019-11-07 16:08:49"
  id: 2
  item_id: 357
  item_type: "IT_Analysis"
  message: null
  name: "pending"
  updated_at: "2019-11-07 16:08:49"
  __proto__: Object
  vendor: null
  </code></pre>
  
  <p>I want to do something if <strong>validation_status</strong> in first place <strong>exists</strong> and if its <strong>key</strong> called <strong>name</strong> is a <strong>certain value</strong> for example "pending". How can I do that in blade?</p>
  
  <p>Here is my try, where right now the <strong>else condition</strong> gets executed as <strong>true</strong>, so something is wrong with my <strong>if condition</strong>:</p>
  
  <pre><code>    &lt;p&gt;
      @if($item-&gt;validation_status &amp;&amp; $item-&gt;validation_status !== null) 
      @if($item-&gt;validation_status-&gt;name  === "pending" )
       &lt;?php echo link_to('admin/items/' . $item-&gt;id . '/validation-status' . $item-&gt;validation_status-&gt;id . '/complete', 'Validate', array('class' =&gt; 'btn btn-primary w-full')); ?&gt;
       &lt;?php echo link_to('admin/items/' . $item-&gt;id . '/validation-status' . $item-&gt;validation_status-&gt;id . '/documentation-needed', 'Request documentation', array('class' =&gt; 'btn btn-primary w-full')); ?&gt;
       &lt;?php echo link_to('admin/items/' . $item-&gt;id . '/validation-status' . $item-&gt;validation_status-&gt;id . '/reject', 'Reject', array('class' =&gt; 'btn btn-primary w-full')); ?&gt;
      @endif
      @else
        &lt;?php echo Form::submit('Accept and Save!', array('class' =&gt; 'btn btn-primary w-full')); ?&gt;
      @endif
      &lt;/p&gt;
  </code></pre>