app/Http/Controllers/HomeController.php
//Obtain the products that are hired
Obtain the products that are hired
Obtain the products that are hired
public function products_hired() {
        $products = DB::table('hired_products')
                        ->join('user_products', 'hired_products.product_id', '=', 'user_products.product_id')
                        ->join('products', 'hired_products.product_id', '=', 'products.product_id')
                        ->join('users', 'hired_products.user_id', '=', 'users.id')
                        ->where('user_products.user_id', Auth::id())
                        ->where('hired_products.status', '=', 'pending')
                        ->orderBy('hired_products.created_at', 'DESC')
                        ->get();
        return view('hired_products', compact('products'));
    }
public function products_hired ( ) { $ products = DB :: table ( 'hired_products' ) -> join ( 'user_products' , 'hired_products.product_id' , '=' , 'user_products.product_id' ) -> join ( 'products' , 'hired_products.product_id' , '=' , 'products.product_id' ) -> join ( 'users' , 'hired_products.user_id' , '=' , 'users.id' ) -> where ( 'user_products.user_id' , Auth :: id ( ) ) -> where ( 'hired_products.status' , '=' , 'pending' ) -> orderBy ( 'hired_products.created_at' , 'DESC' ) -> get ( ) ; return view ( 'hired_products' , compact ( 'products' ) ) ; }
Obtain the products that are hired
Obtain the products that are hired
// ->paginate(5)); // dd($products); // return view('hired_products', [ //     'products' => $products->paginate(5) // ]);