PHP code example of northwestern-sysdev / northwestern-filament-theme

1. Go to this page and download the library: Download northwestern-sysdev/northwestern-filament-theme 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/ */

    

northwestern-sysdev / northwestern-filament-theme example snippets


use Northwestern\FilamentTheme\NorthwesternTheme;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            NorthwesternTheme::make(),
            // ... other plugins
        ])
        // ... rest of panel config
    ;
}

return [
    // A unit lockup (URL or public path). null uses the dept 4.0 "Northwestern" wordmark.
    'lockup' => env('NU_LOCKUP'),

    // The unit responsible for the application, shown in the footer.
    'unit' => [
        'name' => env('NU_UNIT_NAME'),
        'address' => env('NU_UNIT_ADDRESS'),
        'city' => env('NU_UNIT_CITY'),
        'phone' => env('NU_UNIT_PHONE'),
        'fax' => env('NU_UNIT_FAX'),
        'email' => env('NU_UNIT_EMAIL'),
    ],

    'footer' => [
        // Shown under "Quick Links", as label => URL.
        'links' => [],

        // The "Connect" accounts, as network => URL. [] hides the section.
        'social' => [
            'facebook' => 'https://www.facebook.com/NorthwesternU',
            'instagram' => 'https://instagram.com/northwesternu',
            'youtube' => 'https://www.youtube.com/user/NorthwesternU',
        ],
    ],
];

NorthwesternTheme::make()
    ->withoutAssetRegistration()

NorthwesternTheme::make()
    ->withoutEnvironmentIndicator()

NorthwesternTheme::make()
    ->environmentIndicator(
        visible: fn () => ! app()->isProduction() && auth()->user()?->hasRole('admin'),
    )

NorthwesternTheme::make()
    ->environmentIndicator(label: Str::upper(App::environment()))

NorthwesternTheme::make()
    ->impersonationBanner(
        visible: fn () => session()->has('impersonating'),
    )

NorthwesternTheme::make()
    ->impersonationBanner(
        label: fn () => 'Acting as ' . auth()->user()->name,
    )

NorthwesternTheme::make()
    ->impersonationBanner(
        leaveUrl: '/my-app/stop-impersonating',
    )

NorthwesternTheme::make()
    ->impersonationBanner(
        leaveLabel: 'Return to Admin',
    )

NorthwesternTheme::make()
    ->impersonationBanner(
        leaveUrl: '/my-app/stop-impersonating',
        leaveMethod: 'DELETE',
    )

NorthwesternTheme::make()
    ->withoutImpersonationBanner()

'footer' => [
    'links' => [
        'Help' => 'https://example.northwestern.edu/help',
        'Service Status' => 'https://status.example.northwestern.edu',
    ],
],

'footer' => [
    'social' => [
        'linkedin' => 'https://www.linkedin.com/company/example-unit',
        'bluesky' => 'https://bsky.app/profile/example.northwestern.edu',
    ],
],

use Northwestern\FilamentTheme\Footer\RequiredLink;

RequiredLink::Accessibility->url();   // https://www.northwestern.edu/accessibility/report/
RequiredLink::PrivacyStatement->label(); // Privacy Statement

RequiredLink::RESOURCES; // the five links under "Northwestern Resources"
RequiredLink::LEGAL;     // the four links in the bottom bar

NorthwesternTheme::make()
    ->footer(enabled: false)

NorthwesternTheme::make()
    ->footer(enabled: fn () => auth()->user()?->isStudent())

use Northwestern\FilamentTheme\Filters\DateRangeFilter;

public static function table(Table $table): Table
{
    return $table->filters([
        resolve(DateRangeFilter::class)->make(
            name: 'created_at_range',
            label: 'Date Range',
            column: 'created_at',
        ),
    ]);
}
bash
php artisan filament:assets
bash
php artisan vendor:publish --tag=northwestern-filament-theme-config
bash
php artisan northwestern-theme:install
bash
php artisan vendor:publish --tag=northwestern-filament-theme-views