Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Core Laravel Package

moox/core

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation:

    composer require moox/core
    php artisan moox:install
    
    • Run the installer to auto-configure core features (tabs, taxonomies, etc.).
  2. 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'),
        ];
    }
    
    • Tabs render automatically in Filament admin panels.
  3. 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'];
    }
    

Implementation Patterns

Core Workflows

  1. Model Traits

    • Soft Deletes: Extend BaseSoftDeleteInModel for soft-delete functionality.
      use Moox\Core\Traits\Base\BaseSoftDeleteInModel;
      use Moox\Core\Traits\SoftDelete\SingleSoftDeleteInModel;
      
      class YourModel extends Model
      {
          use BaseSoftDeleteInModel, SingleSoftDeleteInModel;
      }
      
    • Publishable Items: Combine with BasePublishableInModel for draft/publish workflows.
  2. Resource Integration

    • Tab Management: Group form fields by tab:
      public static function form(Tabs $tabs): array
      {
          return [
              'general' => [
                  TextInput::make('name'),
                  Select::make('status')->options(['active', 'archived']),
              ],
              'metadata' => [
                  RichEditor::make('description'),
              ],
          ];
      }
      
  3. Taxonomy Hierarchies

    • Define hierarchical taxonomies in config/moox.php:
      'taxonomies' => [
          'categories' => [
              'type' => 'hierarchical',
              'model' => \App\Models\Category::class,
          ],
      ],
      
    • Use in models/resources via HasTaxonomies trait.
  4. Soft Delete Actions

    • Enable bulk/restore actions in resources:
      public static function table(Table $table): Table
      {
          return $table
              ->columns([
                  // ...
              ])
              ->actions([
                  Tables\Actions\Restore::make(),
              ]);
      }
      

Integration Tips

  • Filament Compatibility: Moox Core is designed for Filament v3. Ensure your filament.php config aligns with Moox’s expectations (e.g., resource naming conventions).
  • Model Events: Leverage Moox’s soft-delete/publish events (e.g., SoftDeleted, Published) in listeners:
    YourModel::restored(function ($model) {
        // Send notification
    });
    
  • Custom Tabs: Extend Tab class for dynamic content:
    class DynamicTab extends Tab
    {
        public function getContent(): string
        {
            return view('filament.resources.your-resource.tabs.dynamic')->render();
        }
    }
    

Gotchas and Tips

Pitfalls

  1. Trait Conflicts

    • Issue: Mixing SingleSoftDeleteInResource with other Single* traits (e.g., SinglePublishableInResource) causes conflicts.
    • Fix: Use only one Single* trait per resource. For combined features, await official multi-trait support (track #42).
  2. Taxonomy Model Mismatch

    • Issue: Defining a taxonomy in config/moox.php but using a non-existent model class throws silent errors.
    • Fix: Verify model paths in config/moox.php and run:
      php artisan moox:install --force
      
  3. Soft Delete Scope Overrides

    • Issue: Custom model scopes may bypass Moox’s soft-delete queries.
    • Fix: Ensure scopes use whereNull('deleted_at') or extend Moox’s base trait scopes.
  4. Tab Ordering

    • Issue: Tabs render in alphabetical order by default.
    • Fix: Explicitly set order in tabs():
      return [
          'general' => Tab::make('General')->sort(1),
          'metadata' => Tab::make('Metadata')->sort(2),
      ];
      

Debugging

  • 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.

Extension Points

  1. Custom Tab Content

    • Override tab rendering via view publishing:
      php artisan vendor:publish --tag=moox-views
      
    • Modify resources/views/filament/resources/tabs/tab.blade.php.
  2. Taxonomy Filters

    • Extend taxonomy queries in app/Providers/MooxServiceProvider.php:
      public function boot()
      {
          \Moox\Core\Facades\Taxonomy::macro('customFilter', function ($query, $term) {
              return $query->where('slug', 'like', "%{$term}%");
          });
      }
      
  3. Soft Delete Policies

    • Override default retention logic:
      use Moox\Core\Contracts\SoftDeletesItems;
      
      class YourModel extends Model implements SoftDeletesItems
      {
          public function shouldBePermanentlyDeleted(): bool
          {
              return $this->deleted_at->diffInDays(now()) > 30;
          }
      }
      
  4. Publish Workflows

    • Customize publish logic via model events:
      YourModel::updating(function ($model) {
          if ($model->isDirty('published_at')) {
              // Add pre-publish logic
          }
      });
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle