Laravel join two tables using model
<p>I am developing a laravel application in which I want to join two tables and get the result. I have two models, first one is category.php which is given below.</p>

<pre><code>class Category extends Model implements AuthenticatableContract, CanResetPasswordContract
{


    public function products()
    {
        return $this-&gt;hasMany('App\Products', 'product_category_id');
    }



}
</code></pre>

<p>Second one is products.php</p>

<pre><code>class Products extends Model implements AuthenticatableContract, CanResetPasswordContract
{


    public function category()
    {
        return $this-&gt;belongsTo('App\Category', 'product_category_id');
    }

}
</code></pre>

<p>Now when I write the query <code>Category::where('status', 1)-&gt;get()</code> it is giving the result. But when I try to join the tables using <code>Category::find(1)-&gt;products()-&gt;where('status', 1)-&gt;get();</code> it is giving null result. Please help</p>