youssef-elghaly / database-manager
A Laravel package for managing database migrations and seeders for modular applications
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^8.2
- illuminate/mail: ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
- nwidart/laravel-modules: ^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.0|^10.0
This package is not auto-updated.
Last update: 2025-05-04 21:24:50 UTC
README
A Laravel package that helps manage database migrations and seeders for modular applications.
Features
- Manage database connections for different modules
- Run and track migrations for specific modules
- Create migrations through a builder interface
- Generate and run seeders with various data types
Installation
You can install the package via composer:
composer require youssefElghaly/database-manager
Then publish the package assets:
php artisan vendor:publish --provider="YoussefElghaly\DatabaseManager\DatabaseManagerServiceProvider" --tag="databasemanager-config"
Optionally, you can publish the views and migrations if you want to customize them:
php artisan vendor:publish --provider="YoussefElghaly\DatabaseManager\DatabaseManagerServiceProvider" --tag="databasemanager-views" php artisan vendor:publish --provider="YoussefElghaly\DatabaseManager\DatabaseManagerServiceProvider" --tag="databasemanager-migrations"
Configuration
After publishing the configuration file, you can customize it in config/databasemanager.php
:
// config/databasemanager.php return [ 'connection' => env('DB_MANAGER_CONNECTION', 'database_manager'), 'routes' => [ 'prefix' => 'database-designer', 'middleware' => ['web'], // Add your auth middleware here ], // Other configurations... ];
Add the database connection to your .env
file:
DB_MANAGER_CONNECTION=database_manager
And add the connection to your config/database.php
file:
'connections' => [ // ... 'database_manager' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', ], // ... ]
Run Migrations
Run the package migrations to set up the required tables:
php artisan migrate
Usage
Accessing the Dashboard
Visit /database-designer
in your browser to access the database management dashboard.
Creating Migrations
- Navigate to
/database-designer/create-migration
- Select a module, database connection, and table name
- Add columns and their properties
- Submit the form to create and run the migration
Managing Seeders
- Navigate to
/database-designer/seeder
- Select a module and database table
- Configure seeder settings
- Create and run the seeder
Commands
The package provides custom Artisan commands:
# Check migration status for a specific module
php artisan module:migrate-custom-status {module} --database={connection}
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
The MIT License (MIT). Please see License File for more information.