Package Data | |
---|---|
Maintainer Username: | ed-fruty |
Maintainer Contact: | ed.fruty@gmail.com (Eduard) |
Package Create Date: | 2014-12-02 |
Package Last Update: | 2014-12-03 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-17 03:01:42 |
Package Statistics | |
---|---|
Total Downloads: | 26 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Laravel 4 is not support namespaces in migration classes, but it is not a problem ;)
#Installation
composer require "ed-fruty/laravel4-namespace-migrator": "1.0.0"
app/config/app.php
:'Fruty\LaravelNamespaceMigrator\LaravelNamespaceMigratorServiceProvider',
php artisan config:publish ed-fruty/laravel4-namespace-migrator
#Usage
'reserved' => [
base_path('app/modules/Blog/migrations') => 'Blog\\Migrations\\',
]
It means, when you call migrations like:
php artisan migrate --path=app/modules/Blog/migrations
Migrator automatically searches classes with namespace Blog\Migrations
in that directory.
php artisan migrate --bench=foo/bar
Migrator searches classes with namespace Foo\Bar\Migrations
in workbench/foo/bar/src/migrations
So if workbench namespace does not equal to vendor/package
name you must register it in 'reserved' block like:
base_path('workbench/foo/bar/src/migrations') => 'VendorNamespace\\PackageNamespace\\'
php artisan migrate
By default configs, Migrator firstly searches migration classes with namespace App\database\migrations
in app/database/migrations
and if it does not exists, Migrator tries to load class without namespace from that catalog.