Weave 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

capell-app/core

Capell Core is the platform package behind Capell CMS, owning the shared content model for sites, domains, languages, pages and URLs, plus the package registry, install and upgrade orchestration, settings schemas and extension contracts. It is not an admin UI or public renderer.

View on GitHub
Deep Wiki
Context7

Getting Started

First Steps

  1. Installation

    composer require capell-app/core
    

    Add the service provider to config/app.php:

    'providers' => [
        // ...
        Capell\App\Core\Providers\CoreServiceProvider::class,
    ],
    
  2. Publish Config & Migrations

    php artisan vendor:publish --provider="Capell\App\Core\Providers\CoreServiceProvider"
    

    Run migrations:

    php artisan migrate
    
  3. First Use Case: Content Model Define a basic content model in app/Models/Content/MyModel.php:

    namespace App\Models\Content;
    
    use Capell\App\Core\Models\ContentModel;
    
    class MyModel extends ContentModel
    {
        protected $modelName = 'my_model';
    }
    
  4. Register Model in config/capell.php

    'models' => [
        'my_model' => [
            'class' => \App\Models\Content\MyModel::class,
        ],
    ],
    

Implementation Patterns

1. Content Model Workflows

  • CRUD via API Use the built-in API endpoints (e.g., /api/content/my_model).

    // Create
    $data = $this->contentService->create('my_model', ['title' => 'Test']);
    
    // Fetch
    $item = $this->contentService->find('my_model', 1);
    
  • Event-Driven Extensions Listen to model events (e.g., ContentModelCreated):

    use Capell\App\Core\Events\ContentModelCreated;
    
    event(new ContentModelCreated($model));
    

2. Service Integration

  • Dependency Injection Bind services in AppServiceProvider:

    $this->app->bind(
        \Capell\App\Core\Contracts\ContentService::class,
        \Capell\App\Core\Services\ContentService::class
    );
    
  • Custom Services Extend core services:

    namespace App\Services;
    
    use Capell\App\Core\Services\ContentService;
    
    class MyContentService extends ContentService
    {
        public function customMethod() { ... }
    }
    

3. Extension Points

  • Model Extensions Add fields dynamically:

    class MyModel extends ContentModel
    {
        public function getCustomFieldAttribute()
        {
            return $this->attributes['custom_field'] ?? null;
        }
    }
    
  • Middleware for Content Protect routes:

    Route::middleware(['capell.auth'])->group(function () {
        // ...
    });
    

Gotchas and Tips

Common Pitfalls

  • Migration Conflicts If php artisan migrate fails, check config/capell.php for reserved table names. Fix: Rename tables in config/capell.php under database.tables.

  • Caching Issues Clear caches after extending models:

    php artisan config:clear
    php artisan cache:clear
    
  • Event Listener Registration Ensure listeners are registered in EventServiceProvider:

    protected $listen = [
        ContentModelCreated::class => [
            \App\Listeners\HandleModelCreated::class,
        ],
    ];
    

Debugging Tips

  • Log Model Events Enable debug mode in config/capell.php:

    'debug' => env('APP_DEBUG', false),
    
  • Check Contracts Verify implemented contracts (e.g., ContentService) match the package’s expectations.

Extension Quirks

  • Dynamic Field Validation Override getRules() in models:

    public function getRules()
    {
        return [
            'title' => 'required|string|max:255',
            'custom_field' => 'nullable|string',
        ];
    }
    
  • API Resource Customization Extend Capell\App\Core\Http\Resources\ContentResource for custom responses.

  • Localization Use config/capell.php to set default locale:

    'locale' => 'en',
    
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo