Installation:
composer require mtolhuys/laravel-schematics
php artisan schematics:install
This publishes the config, migrations, and assets.
Run Migrations:
php artisan migrate
Access the Dashboard:
Visit /schematics in your browser to see the interactive model diagram.
/schematics to view all Eloquent models and their relationships in an interactive diagram.hasMany, belongsTo) by dragging and dropping between models.Model Management:
Model classes or migrations.app/Models/).database/migrations/).app/Http/Controllers/).app/Http/Requests/).Relationships:
User hasMany Post).belongsTo, hasMany, etc., methods in your models.Migration Insights:
Form Generation:
Create/Update form requests and Blade views for each model.resources/views/vendor/schematics/.php artisan schematics:scan to import existing models/migrations into the UI.schematics.excluded_models config array.php artisan vendor:publish --tag=schematics.stubs
Schematics facade or service container to programmatically:
use Schematics\Facades\Schematics;
$model = Schematics::findModel('User');
SchematicsService in tests to avoid hitting the database:
$this->partialMock(Schematics::class, ['findModel']);
Database State Mismatch:
php artisan schematics:sync may fail if the database schema doesn’t match the UI state.php artisan schematics:fresh to reset the database and regenerate everything from scratch.Circular Dependencies:
User hasMany Role and Role belongsTo User) can cause UI freezes or errors.UserRole pivot table).Migration Conflicts:
schematics.ignored_migrations.Permission Issues:
/schematics route may be blocked by middleware (e.g., auth).app/Http/Kernel.php middleware exceptions or protect it explicitly:
Route::middleware(['web', 'schematics'])->group(function () {
// Schematics routes
});
Log Output:
config/schematics.php to log actions:
'debug' => env('SCHEMATICS_DEBUG', false),
storage/logs/schematics.log for errors.UI Errors:
php artisan view:clear
php artisan config:clear
Auto-Sync Behavior:
schematics.auto_sync.false (safe mode). Set to true to auto-generate code on model save (risky for shared environments).Field Type Mapping:
php artisan vendor:publish --tag=schematics.field_types
json field type by defining a new class in app/Schematics/FieldTypes/JsonFieldType.php.Excluding Models:
schematics.excluded_models.'excluded_models' => [
'App\Models\AdminPanel\\*', // Exclude all admin panel models
'App\Models\UserSetting', // Exclude specific model
],
Custom Actions:
Schematics\Actions\Action class and registering them in config/schematics.php:
'actions' => [
\App\Schematics\Actions\ExportToExcel::class,
],
Event Listeners:
Schematics::listen('model.saved', function ($model) {
// Trigger custom logic after a model is saved
});
API Extensions:
SchematicsService by binding your own implementation:
$this->app->bind(
\Schematics\SchematicsService::class,
\App\Services\CustomSchematicsService::class
);
How can I help you explore Laravel packages today?