HomeController.php 797 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Http\Controllers\Front;
  3. use App\Shop\Categories\Repositories\Interfaces\CategoryRepositoryInterface;
  4. class HomeController
  5. {
  6. /**
  7. * @var CategoryRepositoryInterface
  8. */
  9. private $categoryRepo;
  10. /**
  11. * HomeController constructor.
  12. * @param CategoryRepositoryInterface $categoryRepository
  13. */
  14. public function __construct(CategoryRepositoryInterface $categoryRepository)
  15. {
  16. $this->categoryRepo = $categoryRepository;
  17. }
  18. /**
  19. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  20. */
  21. public function index()
  22. {
  23. $cat1 = $this->categoryRepo->findCategoryById(2);
  24. $cat2 = $this->categoryRepo->findCategoryById(3);
  25. return view('front.index', compact('cat1', 'cat2'));
  26. }
  27. }