ErrorException in line 82: Trying to get property of non-object (View: D:\xampp2\htdocs\onecreativeweb-benzin.bg-website\resources\views\home.blade.php)
enter code here
My route: Route::get('/', ['as' => 'home', 'uses' => 'Home\HomeController@index']);
HomeController.php:
ContactMessageRepository $contactMessageRepo {
private $contactContentRepo;
private $homeContentRepo;
private $advantageRepo;
private $slidersRepo;
private $benefitsRepo;
...
}
public function __construct(
AdvantageRepository $advantageRepo,
SliderRepository $slidersRepo,
PartnerRepository $partnerRepo,
BenefitRepository $benefitsRepo,
CategoryRepository $categoryRepo,
NewsRepository $newsRepo,
public function index()
{
return view('home')
->with('contacts', $this->contactContentRepo->first())
->with('homeContent', $this->homeContentRepo->first())
->with('sliders', $this->slidersRepo->getAllWithTranslation())
->with('benefits', $this->benefitsRepo->getAllWithTranslation())
->with('advantages', $this->advantageRepo->getModel()->where('show_on_home_page', '=', '1')->get());
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire