title: No query results for model [App\Products] Laravel
body: <p>In laravel5 i got following message(error)</p>
  
  <pre><code>No query results for model [App\Products].
  </code></pre>
  
  <p>I have a table "<code>products</code>" which has a column "<code>category_id</code>" that a <code>category Id</code> of each category items. I want to show the  items according to <code>category Id</code></p>
  
  <p>My controller is like this</p>
  
  <pre><code> public function category()
  {
   $recordsByCategories=\DB::table('products')
              -&gt;select('categories','category_id', \DB::raw('count(*) as totalProducts'))
              -&gt;groupBy('categories')
              -&gt;get();
   return view('dashboard.show',compact('recordsByCategories'));
   }
  
  **//I have received error in below function**
  
   public function searchCategoryByTag($id)
          {
  
           $category_id = Products::findOrFail($id);
           $records=\DB::table('products')-&gt;Where('category_id','$category_id');
            dd($records);
  
          }
  </code></pre>
  
  <p>My routes is like this</p>
  
  <pre><code> Route::get('categorys/{id}' ,array(
      'as'=&gt;'category',
      'uses'=&gt;'GoodsController@searchCategoryByTag'));
  </code></pre>
  
  <p>My view is like this</p>
  
  <pre><code>@foreach($recordsByCategories as $recordsByCategory)
  
      &lt;a href="{{URL::route('category',$recordsByCategory-&gt;category_id)}}
      " id="search"&gt;{{$recordsByCategory-&gt;categories}}&lt;/a&gt;:{{$recordsByCategory-&gt;totalProducts}} 
  
      @endforeach
  </code></pre>