Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Artisan's publish features to make copying migrations an easier process. #174

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
"illuminate/support": "~4.0|~5.0|~5.1"
},
"autoload": {
"classmap": [
"src/migrations"
],
"psr-0": {
"Venturecraft\\Revisionable": "src/"
}
Expand Down
13 changes: 8 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,18 @@ Run composer update to download the package
php composer.phar update
```

Finally, you'll also need to run migration on the package
After updating composer, add the service provider to the `providers` array in `config/app.php`

```
php artisan migrate --package=venturecraft/revisionable
```php
Venturecraft\Revisionable\RevisionableServiceProvider::class,
```

> If you're going to be migrating up and down completely a lot (using `migrate:refresh`), one thing you can do instead is to copy the migration file from the package to your `app/database` folder, and change the classname from `CreateRevisionsTable` to something like `CreateRevisionTable` (without the 's', otherwise you'll get an error saying there's a duplicate class)
Finally, publish the migrations and then migrate.

> `cp vendor/venturecraft/revisionable/src/migrations/2013_04_09_062329_create_revisions_table.php app/database/migrations/`
```
php artisan vendor:publish --provider="Venturecraft\Revisionable\RevisionableServiceProvider"
php artisan migrate
```

## Docs

Expand Down
20 changes: 20 additions & 0 deletions src/Venturecraft/Revisionable/RevisionableServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Venturecraft\Revisionable;

use Illuminate\Support\ServiceProvider;

class RevisionableServiceProvider extends ServiceProvider
{
public function boot()
{
$this->publishes([
__DIR__ . '/../../../database/migrations/' => database_path('/migrations')
], 'migrations');
}

public function register()
{

}
}