Skip to content

Commit

Permalink
Merge pull request #293 from ysknsid25/fixproductimage
Browse files Browse the repository at this point in the history
#Fix Cover image is not displayed on the top page
  • Loading branch information
jsdecena committed Jan 31, 2023
2 parents a7afbfe + 4d47fbd commit 91602fc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions project/app/Http/Controllers/Front/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
namespace App\Http\Controllers\Front;

use App\Shop\Categories\Repositories\Interfaces\CategoryRepositoryInterface;
use App\Shop\Products\Product;
use App\Shop\Products\Transformations\ProductTransformable;

class HomeController
{
use ProductTransformable;

/**
* @var CategoryRepositoryInterface
*/
Expand All @@ -26,7 +30,14 @@ public function __construct(CategoryRepositoryInterface $categoryRepository)
public function index()
{
$cat1 = $this->categoryRepo->findCategoryById(2);
$cat1->products = $cat1->products->map(function (Product $item) {
return $this->transformProduct($item);
});

$cat2 = $this->categoryRepo->findCategoryById(3);
$cat2->products = $cat2->products->map(function (Product $item) {
return $this->transformProduct($item);
});

return view('front.index', compact('cat1', 'cat2'));
}
Expand Down

0 comments on commit 91602fc

Please sign in to comment.