0

I had installed fresh Laravel project and added the Laravel Voyagers Package in it.

Later I had created the Product table with id, title, user_id and created its respective BREAD.

User can have many Products. So for Relationship, I had defined in product table that Every product BelongsTo User. Its working fine till here. But I when I logged in as user then I am able to see all products instead of my assigned products only.

How I can manage this thing in laravel voyagers.

Mohammed Sabir
  • 354
  • 1
  • 4
  • 16

1 Answers1

0

try use :

 $product = Product::all()->where('user_id', auth()->user()->id)->get();

or :

 $product = \DB::table('Product')->where('user_id', auth()->user()->id)->get();
Navneeta
  • 58
  • 5