use ErickComp\BreadcrumbAttributes\Attributes\Breadcrumb;
class MyController
{
#[Breadcrumb(label:'Home', name: 'home')]
public function home()
{
}
#[Breadcrumb(label:'My Data list', parent:'home', name:'home.my-data-list')]
public function myMethod()
{
}
}
use ErickComp\BreadcrumbAttributes\Attributes\Breadcrumb;
class MyController
{
#[Breadcrumb(label:'Home', name: 'home')]
public function home()
{
}
#[Breadcrumb(label:'Users List', parent:'home', name:'home.users-list')]
public function usersList()
{
}
#[Breadcrumb(label: ['Showing user: ', '"', '{user}->name','"'], parent: 'home.users-list', name: 'home.user-list')]
public function showUser(UserModel $user)
{
}
}
use ErickComp\BreadcrumbAttributes\Attributes\Breadcrumb;
use Spatie\RouteAttributes\Attributes\Get;
class MyController
{
#[Get('/', name: 'home')]
#[Breadcrumb(label:'Home')]
public function home()
{
}
#[Get('/users/list', name: 'home.users-list')]
#[Breadcrumb(label:'Users List', parent:'home')]
public function usersList()
{
}
#[Get('/users/show/{user}', name: 'home.users-list.user-show')]
#[Breadcrumb(label: ['Showing user: ', '"', '{user}->name', '"'], parent: 'home.users-list')]
public function showUser(UserModel $user)
{
}
}
// Laravel way for expressing controller actions
CrumbBasket::putCrumbForControllerAction('App\Http\MyController@myMethod1', 'My Method 1', 'start.my-method1', 'start');
// Array callable syntax with using string class name
CrumbBasket::putCrumbForControllerAction(['App\Http\MyController', 'myMethod2'], 'My Method 2', 'start.my-method2', 'start');
// Array callable syntax with using ::class "constant" to access class name
CrumbBasket::putCrumbForControllerAction([\App\Http\MyController::class, 'myMethod3'], 'My Method 3', 'start.my-method3', 'start');
// Route name will be used as breacrumb name
CrumbBasket::putCrumbForRouteName('my-route-1', 'My Method 3', 'start');