Reputation: 108
I´m using Backpack 4.0 for Laravel to create an admin panel.
Let´s say I create vanilla Laravel view (like "foo.blade.php"). I integrate it into the menu creating a link on sidebar_content.blade.php. When I open the web page I want it to have the sidebar, header and styles from Backpack so it`s fully integrated.
What do I have to include in the view to do it?
Upvotes: 2
Views: 663
Reputation: 10127
Shortly, your view must extend @extends(backpack_view('blank'))
.
I'll give a step by step of the complete operation to add a custom page to backpack so it may help others.
First you need to create a Controller, you can create one with php artisan make:controller
CustomController.php
use Illuminate\Routing\Controller;
class CustomController extends Controller {
public function custom()
{
return view('custom');
}
}
Your view must extend @extends(backpack_view('blank'))
and include a content section:
custom.blade.php
@extends(backpack_view('blank'))
@section('content')
<div class="jumbotron mb-2 mt-4">
<h1>Custom</h1>
</div>
@endsection
sidebar_content.blade.php
...
<li class="nav-item"><a class="nav-link" href='{{ backpack_url('custom') }}'><i class="nav-icon fa fa-archive"></i> Custom</a></li>
custom.php (routes)
Route::get('custom', 'CustomController@custom')->name('custom');
Upvotes: 3