3
我有服務供應商類別,這就要求將View Composer類... 但在運行程序後,顯示我這個錯誤類不存在
類OIMS \ HTTP \ SidebarComposer不存在
ComposerServiceProvide類別:
namespace Oims\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\View\Factory as ViewFactory;
class ComposerServiceProvider extends ServiceProvider
{
public function boot(ViewFactory $view)
{
$view->composer('layout.sidebar','Oims\Http\SidebarComposer');
}
SidebarComposer類別:
namespace Oims\Http\SidebarComposer;
use Oims\Menus;
use Illuminate\Contracts\View\View;
class SidebarComposer
{
public function compose(View $view)
{
$menus =Menus::all();
$view->with('menus',$menus);
}
}