Edit

Breadcrumbs


About

Breadcrumbs show a path to the current page in the top-right corner of the screen, and can be a useful part of the UI for deeply nested admin panels.

Breadcrumbs are loaded in the default layout before the header section.

Enable / Disable Breadcrumbs

You can hide or show breadcrumbs on ALL of your admin panel pages by changing a boolean variable in your config/backpack/base.php:

    // Show / hide breadcrumbs on admin panel pages.
    'breadcrumbs' => true,

How Breadcrumbs Work

The inc.breadcrumbs view will show all breadcrumbs from the $breadcrumbs variable, if it's present on the page. The $breadcrumbs variable should be a simple associative array [ $label1 => $link1, $label2 => $link2 ]. Examples:

  $breadcrumbs = [
      trans('backpack::crud.admin') => backpack_url('dashboard'),
      trans('backpack::base.dashboard') => false,
  ];

  $breadcrumbs = [
      trans('backpack::crud.admin') => backpack_url('dashboard'),
      trans('backpack::base.dashboard') => false,
  ];

  $breadcrumbs = [
      'Admin' => route('dashboard'),
      'Dashboard' => false,
  ];

Notice the last item should NOT have a link, it should be false.

How to Define Breadcrumbs

Define Breadcrumbs Inside the Controller

Make sure a $breadcrumbs variable is present inside your views:

    /**
     * Show the admin dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function dashboard()
    {
        $this->data['title'] = trans('backpack::base.dashboard'); // set the page title
        $this->data['breadcrumbs'] = [
            trans('backpack::crud.admin') => backpack_url('dashboard'),
            trans('backpack::base.dashboard') => false,
        ];

        return view('backpack::dashboard', $this->data);
    }

Define Breadcrumbs Inside the View

Make sure a $breadcrumbs variable is present:

@extends('backpack::layout')

@php
  $breadcrumbs = [
      'Admin' => backpack_url('dashboard'),
      'Dashboard' => false,
  ];
@endphp

@section('content')
    some other content here
@endsection

Like our open-core?

Then you'll love our premium add-ons - productivity tools and tons of new features.