1. Go to this page and download the library: Download rawilk/filament-inner-nav library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rawilk / filament-inner-nav example snippets
use App\Filament\Resources\UserResource\Pages;
use Filament\Resources\Resource;
class UserResource extends Resource
{
// ...
public static function getPages(): array
{
'index' => Pages\ListUsers::route('/'),
'create' => Pages\CreateUser::route('/create'),
'edit' => Pages\EditUser::route('/{record}/edit'),
// custom pages...
'authentication' => Pages\UserAuthentication::route('/{record}/authentication'),
'contact' => Pages\Contact::route('/{record}/contact'),
'activity' => Pages\Activity::route('/{record}/activity'),
}
// ...
}
public ModelName $record; // public User $record;
use App\Models\User;
use Filament\Resources\Resource;
use Rawilk\FilamentInnerNav\InnerNav;
use Rawilk\FilamentInnerNav\InnerNavItem;
class UserResource extends Resource
{
// ...
public static function innerNav(User $record): InnerNav
{
return InnerNav::make()
->setNavigationItems([
InnerNavItem::make('Edit User')
->url(fn (): string => static::getUrl('edit', ['record' => $record])),
InnerNavItem::make('Password & Authentication')
->url(fn (): string => static::getUrl('authentication', ['record' => $record])),
InnerNavItem::make('Contact Information')
->url(fn (): string => static::getUrl('contact', ['record' => $record])),
InnerNavItem::make('Activity')
->url(fn (): string => static::getUrl('activity', ['record' => $record])),
]);
}
}
public static function innerNav(User $record): InnerNav
{
return InnerNav::make()
->wireNavigate()
->setNavigationItems([
// ...
]);
}
public static function innerNav(User $record): InnerNav
{
return InnerNav::make()
->setTitle('Nav title')
->setDescription('Nav description')
->setNavigationItems([
// ...
]);
}
public static function innerNav(User $record): InnerNav
{
return InnerNav::make()
->setTitle(fn (): HtmlString => new HtmlString('<h1>' . $record->name . '</h1>'))
->setDescription(fn (): HtmlString => new HtmlString('<p>Nav description</p>'))
->setNavigationItems([
// ...
]);
}
use Rawilk\FilamentInnerNav\Enums\InnerNavLayout;
use Rawilk\FilamentInnerNav\InnerNav;
public static function innerNav(User $record): InnerNav
{
return InnerNav::make()
->setLayout(InnerNavLayout::Top)
->setNavigationItems([
// ...
]);
}
use Illuminate\Support\ServiceProvider;
use Rawilk\FilamentInnerNav\Enums\InnerNavLayout;
use Rawilk\FilamentInnerNav\InnerNav;
use Rawilk\FilamentInnerNav\InnerNavGroup;
class AppServiceProvider extends ServiceProvider
{
public function boot(): void
{
InnerNav::configureUsing(function (InnerNav $nav) {
$nav
->wireNavigate()
->setLayout(InnerNavLayout::Side);
});
InnerNavGroup::configureUsing(function (InnerNavGroup $group) {
// Expand collapsible groups by default.
$group->expandByDefault();
});
}
}