How to use “with” in laravel?

Solution:

i think you can solve your problem following this :

  $query = Product::with('store')->where('store_id', $id)       
            ->get();

And in model :

public function store()
{
    return $this->belongsTo('App\Store','store_id', '_id');
}

And run this command: ‘composer dump-autoload’ in your command prompt.

Thanks…..