oriondevelops/filament-feedback

A Filament plugin to collect feedback.

v0.1.0 2023-11-25 21:06 UTC

This package is auto-updated.

Last update: 2024-12-18 09:03:13 UTC


README

Latest Version on Packagist Total Downloads

This Filament plugin is a simple wizard that collects user feedback and forwards it to the chosen email address.

Installation

You can install the package via composer:

composer require oriondevelops/filament-feedback

Next ensure you setup a mail service.

Usage

You need to register the plugin with your preferred Filament panel providers. This can be done inside of your PanelProvider, e.g. AdminPanelProvider.

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentFeedback\FeedbackPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(
                FeedbackPlugin::make()
                    ->sendResponsesTo(email: 'oriondevelops@gmail.com')
            );
    }
}

You can now click on the "Feedback" menu item in your Filament app to see the feedback plugin.

Customizing visibility

Define who can view the feedback page.

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentFeedback\FeedbackPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(
                FeedbackPlugin::make()
                    ->visible(fn() => auth()->user()->can('view feedback page'))
            );
    }
}

Customizing the navigation item

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentFeedback\FeedbackPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(
                FeedbackPlugin::make()
                    ->slug('feedback')
                    ->label('Feedback')
                    ->icon('heroicon-o-face-smile')
                    ->group('Help')
                    ->sort(3),
            );
    }
}

Customizing the page

<?php

namespace App\Providers\Filament;

use Filament\Panel;
use Filament\PanelProvider;
use Orion\FilamentFeedback\FeedbackPlugin;
use App\Filament\Pages\ExtendedFeedbackPage;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(
                FeedbackPlugin::make()
                    ->page(ExtendedFeedbackPage::class),
            );
    }
}

Contributing

Please see CONTRIBUTING for details.

Security

Please review Security Policy on how to report security vulnerabilities.

Credits

License

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