From 62cde0079a92e30805b68ea6e40103c76168457f Mon Sep 17 00:00:00 2001 From: "simon.schneider" Date: Fri, 10 Jul 2015 13:40:32 +0200 Subject: [PATCH] Updated package to laravel 5.1 package conventions. Now we publish migrations instead of keeping them in the package directory structure. Ready for Laravel 5.1 :D --- README.md | 7 +++++-- src/Triggerdesign/Hermes/HermesServiceProvider.php | 7 +++++-- src/commands/MigrationCommand.php | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fe19c72..55d4a5c 100644 --- a/README.md +++ b/README.md @@ -62,10 +62,13 @@ Run a **composer update**. ); ``` -### Step 3: Migrate tables +### Step 3: Publish migrations and config + ``` -$ php artisan migrate --package="triggerdesign/hermes" + php artisan vendor:publish + php artisan migrate ``` + Now you have the 4 tables that we need for user conversations. ### Step 4: Use the user trait diff --git a/src/Triggerdesign/Hermes/HermesServiceProvider.php b/src/Triggerdesign/Hermes/HermesServiceProvider.php index 980f532..55eea23 100644 --- a/src/Triggerdesign/Hermes/HermesServiceProvider.php +++ b/src/Triggerdesign/Hermes/HermesServiceProvider.php @@ -24,7 +24,9 @@ public function boot() }); $this->publishes([ - __DIR__.'/../config/config.php' => config_path('hermes.php'), + __DIR__.'/../../config/config.php' => config_path('hermes.php'), + __DIR__.'/../../migrations/' => database_path('/migrations'), + ]); @@ -32,7 +34,8 @@ public function boot() return new \MigrationCommand(); }); - $this->commands(['hermes::command.migration']); + //Use the published migration instead of a command (the documented Laravel 5.1 way) + //$this->commands(['hermes::command.migration']); } diff --git a/src/commands/MigrationCommand.php b/src/commands/MigrationCommand.php index 2013822..7628a97 100644 --- a/src/commands/MigrationCommand.php +++ b/src/commands/MigrationCommand.php @@ -15,6 +15,10 @@ class MigrationCommand extends Command{ */ protected $description = 'Migrate the necessary package migration files for hermes (messages, conversations, conversation_user, message_states).'; + public function __construct(){ + $this->app = app(); + } + /** * Run the package migrations */