title: Call to a member function where() on array laravel
body: <p>I have two tables <strong>tbl_law_master</strong> &amp; <strong>tbl_law_sub_master</strong>
  on both these tables there is a column named as <strong>assigned_to</strong>, this column stores user's id.</p>
  
  <p>my task is to get <strong>sublaw</strong> from tbl_law_sub_master for particular <strong>user's id</strong> by joining <strong>law_id</strong> of tbl_law_master.</p>
  
  <p>this is my code,</p>
  
  <pre><code>$law_id = $_GET['law_id'];
  
  $sublaw = DB::table('tbl_law_sub_master')
              -&gt;select('tbl_law_sub_master.*', 'tbl_law_master.lm_id', 'tbl_law_master.law_name', 'tbl_law_master.id as lawId')
              -&gt;leftJoin('tbl_law_master', 'tbl_law_master.id', '=', 'tbl_law_sub_master.lm_id')
              -&gt;where('tbl_law_sub_master.lm_id', $law_id)
              -&gt;orderBy('type_of_event', 'asc')
              -&gt;orderBy('section', 'asc')
              -&gt;orderBy('rules', 'asc')
              -&gt;orderBy('notification', 'asc')
              -&gt;orderBy('circular', 'asc')-&gt;get();
  
  if (!in_array(Auth::user()-&gt;role, [1, 7])) 
  {
     $sublaw = $sublaw-&gt;where('tbl_law_master.assigned_to', Auth::user()-&gt;id);
  }
  </code></pre>
  
  <p>it shows me <strong>error</strong> as </p>
  
  <blockquote>
    <p>Call to a member function where() on array</p>
  </blockquote>