Installation:
composer require moox/core
php artisan moox:install
First Use Case: Dynamic Tabs Define tabs in a resource configuration:
// app/Filament/Resources/YourResource.php
public static function tabs(): array
{
return [
'general' => Tab::make('General'),
'metadata' => Tab::make('Metadata')->icon('heroicon-o-tag'),
];
}
Quick Taxonomy Example: Attach a taxonomy to a model:
// app/Models/YourModel.php
use Moox\Core\Traits\Taxonomy\HasTaxonomies;
class YourModel extends Model
{
use HasTaxonomies;
protected $taxonomies = ['categories', 'tags'];
}
Model Traits
BaseSoftDeleteInModel for soft-delete functionality.
use Moox\Core\Traits\Base\BaseSoftDeleteInModel;
use Moox\Core\Traits\SoftDelete\SingleSoftDeleteInModel;
class YourModel extends Model
{
use BaseSoftDeleteInModel, SingleSoftDeleteInModel;
}
BasePublishableInModel for draft/publish workflows.Resource Integration
public static function form(Tabs $tabs): array
{
return [
'general' => [
TextInput::make('name'),
Select::make('status')->options(['active', 'archived']),
],
'metadata' => [
RichEditor::make('description'),
],
];
}
Taxonomy Hierarchies
config/moox.php:
'taxonomies' => [
'categories' => [
'type' => 'hierarchical',
'model' => \App\Models\Category::class,
],
],
HasTaxonomies trait.Soft Delete Actions
public static function table(Table $table): Table
{
return $table
->columns([
// ...
])
->actions([
Tables\Actions\Restore::make(),
]);
}
filament.php config aligns with Moox’s expectations (e.g., resource naming conventions).SoftDeleted, Published) in listeners:
YourModel::restored(function ($model) {
// Send notification
});
Tab class for dynamic content:
class DynamicTab extends Tab
{
public function getContent(): string
{
return view('filament.resources.your-resource.tabs.dynamic')->render();
}
}
Trait Conflicts
SingleSoftDeleteInResource with other Single* traits (e.g., SinglePublishableInResource) causes conflicts.Single* trait per resource. For combined features, await official multi-trait support (track #42).Taxonomy Model Mismatch
config/moox.php but using a non-existent model class throws silent errors.model paths in config/moox.php and run:
php artisan moox:install --force
Soft Delete Scope Overrides
whereNull('deleted_at') or extend Moox’s base trait scopes.Tab Ordering
tabs():
return [
'general' => Tab::make('General')->sort(1),
'metadata' => Tab::make('Metadata')->sort(2),
];
Enable Moox Logging:
Add to config/logging.php:
'channels' => [
'moox' => [
'driver' => 'single',
'path' => storage_path('logs/moox.log'),
'level' => 'debug',
],
],
Then log Moox events:
\Moox\Core\Facades\Moox::debug('Custom log message');
Check Installed Features: Run:
php artisan moox:check
Lists enabled/disabled features and their configurations.
Custom Tab Content
php artisan vendor:publish --tag=moox-views
resources/views/filament/resources/tabs/tab.blade.php.Taxonomy Filters
app/Providers/MooxServiceProvider.php:
public function boot()
{
\Moox\Core\Facades\Taxonomy::macro('customFilter', function ($query, $term) {
return $query->where('slug', 'like', "%{$term}%");
});
}
Soft Delete Policies
use Moox\Core\Contracts\SoftDeletesItems;
class YourModel extends Model implements SoftDeletesItems
{
public function shouldBePermanentlyDeleted(): bool
{
return $this->deleted_at->diffInDays(now()) > 30;
}
}
Publish Workflows
YourModel::updating(function ($model) {
if ($model->isDirty('published_at')) {
// Add pre-publish logic
}
});
How can I help you explore Laravel packages today?