FleetCart/Modules/Admin/Http/ViewCreators/AdminSidebarCreator.php

36 lines
863 B
PHP
Raw Permalink Normal View History

2023-06-11 12:14:03 +00:00
<?php
namespace Modules\Admin\Http\ViewCreators;
use Illuminate\View\View;
use Modules\Admin\Sidebar\AdminSidebar;
use Maatwebsite\Sidebar\Presentation\SidebarRenderer;
class AdminSidebarCreator
{
/**
* @var \Modules\Admin\Sidebar\AdminSidebar
*/
protected $sidebar;
/**
* @var \Maatwebsite\Sidebar\Presentation\SidebarRenderer
*/
protected $renderer;
/**
* @param \Modules\Admin\Sidebar\AdminSidebar $sidebar
* @param \Maatwebsite\Sidebar\Presentation\SidebarRenderer $renderer
*/
public function __construct(AdminSidebar $sidebar, SidebarRenderer $renderer)
{
$this->sidebar = $sidebar;
$this->renderer = $renderer;
}
public function create(View $view)
{
$view->sidebar = $this->renderer->render($this->sidebar);
}
}