Skip to content

awcodes/overlook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1f543a1 · Jun 14, 2023

History

35 Commits
May 29, 2023
Jun 14, 2023
Jun 14, 2023
Jun 14, 2023
Jun 14, 2023
Jun 14, 2023
Mar 15, 2023
Mar 15, 2023
Mar 15, 2023
Jun 14, 2023
May 27, 2023
Mar 15, 2023
Mar 15, 2023
Mar 15, 2023
Mar 15, 2023

Repository files navigation

Overlook for Filament

Latest Version on Packagist Total Downloads

A Filament plugin that adds an app overview widget to your admin panel.

overlook-og

Installation

You can install the package via composer:

composer require awcodes/overlook

Then add the widget to your dashboard class or the Filament config file.

'widgets' => [
    'namespace' => 'App\\Filament\\Widgets',
    'path' => app_path('Filament/Widgets'),
    'register' => [
        \Awcodes\Overlook\Overlook::class,
        ...
    ],
],

Configuration

By default, Overlook will display any resource registered with Filament, while still honoring the canViewAny policy. This can be undesired and also slow down the dashboard. To prevent this behavior publish the config file with:

php artisan vendor:publish --tag="overlook-config"

Inside the config you will have options to either "include" or "exclude" resources from being displayed. These are not meant to work together, you should use one of the other.

You can also choose to convert the count to a human-readable format. For example, 1000 will be converted to 1k. This is the default behavior.

Converted counts will also have a tooltip that displays the full count. This can be disabled by setting enable_convert_tooltip to false.

You can also control the number of columns the grid will use at each breakpoint. You can set a breakpoint to null to disable it.

return [
    'includes' => [
        App\Filament\Resources\Blog\AuthorResource::class,
        App\Filament\Resources\Blog\CategoryResource::class,
        App\Filament\Resources\Blog\PostResource::class,
    ],
    'excludes' => [
        // App\Filament\Resources\Blog\AuthorResource::class,
    ],
    'should_convert_count' => true,
    'enable_convert_tooltip' => true,
    'grid' => [
        'default' => 2,
        'sm' => 2,
        'md' => 3,
        'lg' => 4,
        'xl' => 5,
        '2xl' => null,
    ],
    'disable_css' => false,
];

Reordering & Polling

Should you need to reorder the location of the widget or want to enable polling, you can make your own version of the Overlook widget and register it instead.

namespace App\Filament\Widgets;

use Awcodes\Overlook\Overlook;

class CustomOverlookWidget extends Overlook
{
    protected static ?int $sort = 10;

    protected static ?string $pollingInterval = '10s';
}

Usage with a Custom Filament Theme

In order to use your theme's colors you will need to disable the loading of the plugin's css file via the config and include the plugin's css file in your theme's css file and add the plugin views to your tailwind config.

custom-theme.css

@import '<path-to-vendor>/awcodes/overlook/resources/css/overlook.css';

tailwind.config.js

content: [
    ...
    '<path-to-vendor>/awcodes/overlook/resources/views/**/*.blade.php',
]

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.