I would like to make a dashboard for the administrator. I have seen several tutorials but they are all either you have to integrate a package or a template. I am trying to make an admin dashboard from scratch by myself.
Admin home.blade.php
@extends('layouts.app')
@section('content')
<div >
<div >
<div >
<div >
<div >Super Admin Dashboard</div>
<div >
@if (session('status'))
<div >
{{ session('status') }}
</div>
@endif
This is Admin Dashboard. You must be super privileged to be here !
@auth
@if(Auth::user()->hasRole('ROLE_SUPERADMIN'))
<li >
<a href="{{ route('superadmin') }}">Dashboard</a>
</li>
<li >
<a href="{{ route('categories.index') }}">Categories</a>
</li>
<li >
<a href="{{ route('subcategories.index') }}">SubCategories</a>
</li>
@endif
@endauth
</div>
</div>
</div>
</div>
</div>
@endsection
I'm trying to make a sidebar in bootstrap 5 and laravel 9 but I can't. When I remove the @extends at the top , the page shows up in white. But I would like to remove this navbar in the dashboard and make a vertical navbar by myself Categories SubCategories I would like the navbar on the left to make a dropdown design and put the categories and subcategories in this dropdown, what should I do if I can't delete the extends with the layout? can someone give me the answer to this problem?
CodePudding user response:
You can pass parameters to @extend
@extends('layouts.app', ['navbar' => false])
@section('content')
{{-- Your content --}}
@endsection
And in your layouts.app
@if(!isset($navbar) || $navbar)
<nav>
{{-- Your navbar code --}}
</nav>
@endif
CodePudding user response:
You can separate Navbar from Sidebar in different files components and use it whenever you want