title: How to query for "where data does not exist" in Laravel?
body: <p>I am trying to make a query which says something like if hire_status exist, do not print out those value instead only print out those with hire_status that doesn't have value yet. But I do not know how to do it. I did something like that for now, can someone help me? Is another kind of function to do it?</p>
  
  <p>What I want to do is inside the view file, when the user has inserted his data into the database, their name should disappear inside the view file to avoid clicking the person name twice. But I do not know how to do that</p>
  
  <p>Here is the code:</p>
  
  <pre><code>     public function getHire(){
          $data['data'] = DB::table('personal_infos')-&gt;join('hires', 'personal_infos.id', '=', 'hires.user_id')-&gt;select('personal_infos.id','personal_infos.Name','personal_infos.deleted_at','hires.hire_status')-&gt;where('deleted_at',NULL)-&gt;whereNull('hires.hire_status')-&gt;get()-&gt;sortByDesc('created_at');
         if(count($data)&gt;0){
          return view('hire',$data);
      }else{
      return view('hire');
  }
  </code></pre>
  
  <p>personal_info models:</p>
  
  <pre><code>class personal_info extends Eloquent
  {
      use SoftDeletes;
      protected $fillable = array('Email', 'Name');
      protected $table = 'personal_infos';
      protected $primaryKey = 'id';
      protected $dates = ['deleted_at'];
  public function hires() {
          return $this-&gt;hasOne('App\hire','user_id');
      }
  }
  </code></pre>
  
  <p>hire model:</p>
  
  <pre><code>   protected $fillable = array('hire_status','user_id');
  
  public function personal_infos() {
      return $this-&gt;belongsTo('App\personal_info', 'user_id', 'id');
  }
  </code></pre>
  
  <p>hire.blade.php</p>
  
  <pre><code>   &lt;table class="table table-bordered"&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;strong&gt;&lt;big&gt;Name: &lt;/big&gt;&lt;/strong&gt;&lt;/th&gt;     
          &lt;th&gt;&lt;strong&gt;&lt;big&gt;Hire Action: &lt;/big&gt;&lt;/strong&gt;&lt;/th&gt;  
        &lt;/tr&gt;
        &lt;td&gt;
        &lt;tr&gt;
          @foreach($data as $value)
        &lt;tr&gt;    
        &lt;th&gt;&lt;a href="{{route('user.show',['id'=&gt;$value-&gt;id])}}"&gt;{{$value-&gt;Name}}&lt;/a&gt;&lt;/th&gt;
      &lt;th&gt; 
        &lt;form class="form-horizontal" method="post" action="{{ url('/hire_status/'.$value-&gt;id) }}"&gt;
          {{ csrf_field() }}
           &lt;input type="hidden" name="user_id" value="{{$value-&gt;id}}"&gt;
          &lt;input type="radio" name="hire_status" value="Yes"&gt; Yes&lt;br&gt;
          &lt;input type="radio" name="hire_status" value="No"&gt; No&lt;br&gt; 
  
           &lt;div class="form-group"&gt;
              &lt;div class="col-md-6-offset-2"&gt;
                &lt;input type="submit" class="btn btn-primary" value="Save"&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
          &lt;/form&gt;  
     &lt;/th&gt;             
        &lt;/tr&gt;
          @endforeach
        &lt;/tr&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>