In my laravel application I have two tables called, apps and app_payments.I wanted to join the two tables and I did it as mentioned in the below laravel ELOQUENT. In the joined table, I have one column to store user ids (user_id). The following ELOQUENT returns me multiple rows for certain user
$sites=DB::table('app_payments')
->join('apps', 'app_payments.app_id', '=', 'apps.appId')
->select('app_payments.*', 'apps.*')
->where ('apps.appId','=',$id)
->get();
return view('payments.show',compact('sites'))
->with('i', (request()->input('page', 1) - 1) * 100);
But I only need to select one row for one (specific) user id, I know I might have to use DISTINCT there but, struggling to use it in this laravel ELOQUENT.
How can I modify above ELOQUENT to achieve that?