Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit

Permalink
Updating command
Browse files Browse the repository at this point in the history
  • Loading branch information
fletch3555 committed Dec 14, 2016
1 parent 8d334f5 commit c62fc82
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/Commands/MakeModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ protected function buildClass($name)
*/
protected function addSoftDelete(&$stub)
{
$trait = '';
$traitIncl = $trait = '';

if ($this->option('softdelete')) {
$trait = 'use Illuminate\Database\Eloquent\SoftDeletes;';
$traitIncl = 'use Illuminate\Database\Eloquent\SoftDeletes;';
$trait = 'use SoftDeletes;';
}

$stub = str_replace('DummySDTrait', $trait, $stub);
$stub = str_replace('//DummySDTraitInclude', $traitIncl, $stub);
$stub = str_replace('//DummySDTrait', $trait, $stub);

return $this;
}
Expand Down
16 changes: 13 additions & 3 deletions src/VoyagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ public function register()

if ($this->app->runningInConsole()) {
$this->registerPublishableResources();
$this->registerCommands();
$this->registerConsoleCommands();
} else {
$this->registerAppCommands();
}

}

/**
Expand Down Expand Up @@ -88,13 +91,20 @@ private function registerPublishableResources()
}

/**
* Register the console commands.
* Register the commands accessible from the Console.
*/
private function registerCommands()
private function registerConsoleCommands()
{
$this->commands(Commands\InstallCommand::class);
$this->commands(Commands\ControllersCommand::class);
$this->commands(Commands\AdminCommand::class);
}

/**
* Register the commands accessible from the App.
*/
private function registerAppCommands()
{
$this->commands(Commands\MakeModelCommand::class);
}
}
3 changes: 2 additions & 1 deletion stubs/model.stub
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace DummyNamespace;

use Illuminate\Database\Eloquent\Model;
//DummySDTraitInclude

class DummyClass extends Model
{
DummySDTrait
//DummySDTrait
}

0 comments on commit c62fc82

Please sign in to comment.