Ребята всем привет опять. Борюсь с дублированием запросов.
http://joxi.ru/n2Yla7zibd90BmВ классе View делаю так
public function compose($view){
if (!$this->categories) {
$this->categories = Category::where('visible', 1)->orderBy('id','asc');
}
return $view->with('categories', $this->categories->all());
}
А в composerServiceProvider.php делаю так
public function register()
{
$this->app->singleton(\App\Views\CategoryViewAll::class);
}
Но проблема с дублированием остается. Может кто ткнет где я и что упустил?