Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Added Config Option to run migrations (#78)
Browse files Browse the repository at this point in the history
* Added Config Option to run migrations

* Added default option

* Added publishes commands

* Moved config as per other engineers advice

* Moved config files
  • Loading branch information
bretto36 authored and kaidesu committed May 17, 2018
1 parent 7950873 commit c474f82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config/shinobi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'run-migrations' => true,
];
14 changes: 12 additions & 2 deletions src/ShinobiServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ class ShinobiServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->publishes([
__DIR__.'/../config/shinobi.php' => config_path('shinobi.php'),
]);

if (version_compare(Application::VERSION, '5.3.0', '<')) {
$this->publishes([
__DIR__.'/../migrations' => $this->app->databasePath().'/migrations',
__DIR__ . '/../migrations' => $this->app->databasePath() . '/migrations',
], 'migrations');
} else {
$this->loadMigrationsFrom(__DIR__.'/../migrations');
if (config('shinobi.run-migrations', true)) {
$this->loadMigrationsFrom(__DIR__ . '/../migrations');
}
}

$this->registerBladeDirectives();
Expand All @@ -40,6 +46,10 @@ public function boot()
*/
public function register()
{
$this->mergeConfigFrom(
__DIR__.'/../config/shinobi.php', 'shinobi'
);

$this->app->singleton('shinobi', function ($app) {
$auth = $app->make('Illuminate\Contracts\Auth\Guard');

Expand Down

0 comments on commit c474f82

Please sign in to comment.