title: laravel eloquent - need help coverting a restrictions white list into a black list
body: <p>I currently have a resources table :</p>
  <ul>
  <li>Resources table has the columns: id - title- description - path</li>
  </ul>
  <p>and a resource_user_role_restrictions table</p>
  <ul>
  <li>resource_user_role_restrictionstable has the columns: id - resource_id - role_id - viewable</li>
  </ul>
  <p>My model contains the following function that checks the resource_user_role_restrictions table and returns all resources whose resource_user_role_restrictions.role_id matches the passed in $userRoleId and if it's viewable column set to 1:</p>
  <pre><code>public function scopeResourcesFilter($query, array $filters) {
       $userRoleId = $filters[0];
  
       $query-&gt;whereHas('resourceUserRoleRestrictions', function  ($query) use($userRoleId){
           $query-&gt;where('viewable', 1)-&gt;where(&quot;role_id&quot;, $userRoleId );
       });
      }
  
  </code></pre>
  <p>This function is called in my controller:</p>
  <pre><code>$userRoleId = Auth::user()-&gt;role_id;
  
  $resources = Resource::resourcesFilter([$userRoleId])-&gt;with('country', 'resourceUserRoleRestrictions')-&gt;get();
  </code></pre>
  <p>However, this now needs to be converted into a black list whereby the viewable column is removed and any resource on the table is assumed to be restricted and not viewable, thus not returned. I cant figure out how to get it woking. Ideally this function should now return all items from the resources table except those whose  resource_user_role_restrictions.user_role matches the passed in $userRoleId.</p>
  <p>Any help at all would be greatly appreciated.</p>