title: check if value exists in array
body: <p>I have 2 queries and I want to check if values of one queries exists in array of other query. I have "maintenance" which has "process_id" and "processes" (array of process id's). I want to check for each process_id if exists in processes. in my controller:</p>
  
  <pre><code>$processes = DB::select('select id from processes');
  $maintenance = DB::select('select process_id from maintenances where car_id ="' . $id . '" group by process_id');
          $result = array();
          foreach ($processes as $key =&gt; $value) {
              $result[] = $value-&gt;id;
          }
  </code></pre>
  
  <p>In my Helper.php</p>
  
  <pre><code>public static function array_value($value, $array) {
          $results = 0;
          $str = "$value";
          if (in_array($str, $array)) {
              $results += 5;
          } else {
              $results += 1;
          }
          return $results;
      }
  </code></pre>
  
  <p>In my view</p>
  
  <pre><code> @foreach ($maintenance as $m)                         
            &lt;tr&gt; @if (Helpers\Helper::array_value($m-&gt;process_id, $processes)== 5)
                 &lt;td&gt;   {{ $m-&gt;process }} &lt;/td&gt;
                  @elseif (Helpers\Helper::array_value($m-&gt;process_id, $processes)== 1) 
                    &lt;td&gt;Missing&lt;/td&gt;    
                     @endif
            &lt;/tr&gt;                                                 
    @endforeach
  </code></pre>
  
  <p>And it displays only values in the first if. It doesn't displays Missing when process_id isn't found in array processes</p>