Installation
composer require qalainau/filament-inbox
Publish the package assets and migrations:
php artisan vendor:publish --provider="Qalainau\FilamentInbox\FilamentInboxServiceProvider" --tag="filament-inbox-migrations"
php artisan vendor:publish --provider="Qalainau\FilamentInbox\FilamentInboxServiceProvider" --tag="filament-inbox-config"
php artisan vendor:publish --provider="Qalainau\FilamentInbox\FilamentInboxServiceProvider" --tag="filament-inbox-assets"
Run migrations:
php artisan migrate
Register the Plugin
Add to your app/Providers/Filament/AdminPanelProvider.php:
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
\Qalainau\FilamentInbox\FilamentInboxPlugin::make(),
]);
}
First Use Case
filament-inbox permission.Message Composition
recipient_resolver).Thread Management
Message Organization
trash_retention_days).Read Receipts
read_receipts_enabled in config.Multi-Tenancy
tenant_resolver in config.Customizing Recipients
Override the default recipient resolver in config/filament-inbox.php:
'recipient_resolver' => \App\Services\CustomRecipientResolver::class,
Implement Qalainau\FilamentInbox\Contracts\RecipientResolver.
Extending Message Data
Add custom fields to messages by publishing the migration and extending the Message model:
use Qalainau\FilamentInbox\Database\Models\Message;
class ExtendedMessage extends Message
{
protected $casts = [
'custom_field' => 'string',
];
}
Customizing the UI Override blade templates by publishing views:
php artisan vendor:publish --provider="Qalainau\FilamentInbox\FilamentInboxServiceProvider" --tag="filament-inbox-views"
Modify files in resources/views/vendor/filament-inbox/.
Adding Permissions Use Filament’s gate system to restrict access:
Gate::define('filament-inbox-access', function ($user) {
return $user->hasRole(['admin', 'support']);
});
Event Listeners
Listen to message events (e.g., MessageSent, MessageRead) for custom logic:
use Qalainau\FilamentInbox\Events\MessageSent;
MessageSent::listen(function (MessageSent $event) {
// Log or notify when a message is sent
});
Search and Filters
Extend the default search/filter logic by overriding the InboxResource:
use Qalainau\FilamentInbox\Resources\InboxResource;
class CustomInboxResource extends InboxResource
{
public static function getRelations(): array
{
return array_merge(parent::getRelations(), [
// Add custom relations
]);
}
}
Migration Conflicts
Message model, ensure your migration doesn’t conflict with the package’s default schema.Schema::table() instead of Schema::create() for custom fields.Permission Issues
filament-inbox permission will see a 403 error.config/filament.php under permissions.Attachment Limits
max_attachment_size in config/filament-inbox.php (default: 10MB).Threading Quirks
reply_to_message_id explicitly when forwarding to maintain thread context.Read Receipts Overhead
Log Messages
Enable debug mode in config/filament-inbox.php:
'debug' => env('FILAMENT_INBOX_DEBUG', false),
Logs will appear in storage/logs/filament-inbox.log.
Database Issues
filament_inbox_messages table exists and has the correct schema.Asset Loading
resources/views/vendor/filament-inbox/partials/script.blade.php.Custom Message Types
Extend the Message model to support different message types (e.g., "Notification", "Support Ticket"):
class Message extends \Qalainau\FilamentInbox\Database\Models\Message
{
protected $casts = [
'type' => 'string',
];
}
Filter messages in the UI by type using custom resources.
Webhook Integration Trigger external actions (e.g., Slack notifications) via event listeners:
MessageSent::listen(function ($event) {
// Send Slack notification
});
API Endpoints Expose message data via Laravel API routes:
Route::get('/api/messages', [\Qalainau\FilamentInbox\Http\Controllers\MessageController::class, 'index']);
Custom Actions Add buttons or actions to the message list/table:
use Filament\Tables\Actions\Action;
Action::make('customAction')
->action(function (Message $record) {
// Custom logic
});
Multi-Language Support
Override translation strings in resources/lang/vendor/filament-inbox.
Example:
{
"messages": {
"compose": "Send a New Message"
}
}
How can I help you explore Laravel packages today?