Skip to content

Commit e531489

Browse files
authored
Merge pull request #197 from Laravel-Backpack/pr/188
Pr/188 - allow stub publish
2 parents e2b4294 + ccbfc2e commit e531489

14 files changed

+59
-20
lines changed

src/Console/Commands/ChartControllerBackpackCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
class ChartControllerBackpackCommand extends GeneratorCommand
99
{
10+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
11+
1012
/**
1113
* The console command name.
1214
*
@@ -55,7 +57,7 @@ protected function getPath($name)
5557
*/
5658
protected function getStub()
5759
{
58-
return __DIR__.'/../stubs/chart-controller.stub';
60+
return $this->getStubPath('chart-controller');
5961
}
6062

6163
/**

src/Console/Commands/ConfigBackpackCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
class ConfigBackpackCommand extends GeneratorCommand
88
{
9+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
10+
911
/**
1012
* The console command name.
1113
*
@@ -41,7 +43,7 @@ class ConfigBackpackCommand extends GeneratorCommand
4143
*/
4244
protected function getStub()
4345
{
44-
return __DIR__.'/../stubs/config.stub';
46+
return $this->getStubPath('config');
4547
}
4648

4749
/**

src/Console/Commands/CrudControllerBackpackCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class CrudControllerBackpackCommand extends BackpackCommand
99
{
1010
use \Backpack\CRUD\app\Console\Commands\Traits\PrettyCommandOutput;
11+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
1112

1213
/**
1314
* The console command name.
@@ -94,7 +95,7 @@ protected function getPath($name)
9495
*/
9596
protected function getStub()
9697
{
97-
return __DIR__.'/../stubs/crud-controller.stub';
98+
return $this->getStubPath('crud-controller');
9899
}
99100

100101
/**

src/Console/Commands/CrudModelBackpackCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class CrudModelBackpackCommand extends BackpackCommand
99
{
1010
use \Backpack\CRUD\app\Console\Commands\Traits\PrettyCommandOutput;
11+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
1112

1213
/**
1314
* The console command name.
@@ -145,7 +146,7 @@ public function handle()
145146
*/
146147
protected function getStub()
147148
{
148-
return __DIR__.'/../stubs/crud-model.stub';
149+
return $this->getStubPath('crud-model');
149150
}
150151

151152
/**

src/Console/Commands/CrudOperationBackpackCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
class CrudOperationBackpackCommand extends GeneratorCommand
99
{
10+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
11+
1012
/**
1113
* The console command name.
1214
*
@@ -55,7 +57,7 @@ protected function getPath($name)
5557
*/
5658
protected function getStub()
5759
{
58-
return __DIR__.'/../stubs/crud-operation.stub';
60+
return $this->getStubPath('crud-operation');
5961
}
6062

6163
/**

src/Console/Commands/CrudRequestBackpackCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class CrudRequestBackpackCommand extends BackpackCommand
99
{
1010
use \Backpack\CRUD\app\Console\Commands\Traits\PrettyCommandOutput;
11+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
1112

1213
/**
1314
* The console command name.
@@ -93,7 +94,7 @@ protected function getPath($name)
9394
*/
9495
protected function getStub()
9596
{
96-
return __DIR__.'/../stubs/crud-request.stub';
97+
return $this->getStubPath('crud-request');
9798
}
9899

99100
/**

src/Console/Commands/ModelBackpackCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
class ModelBackpackCommand extends GeneratorCommand
99
{
10+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
11+
1012
/**
1113
* The console command name.
1214
*
@@ -43,10 +45,10 @@ class ModelBackpackCommand extends GeneratorCommand
4345
protected function getStub()
4446
{
4547
if ($this->option('softdelete')) {
46-
return __DIR__.'/../stubs/model-softdelete.stub';
48+
return $this->getStubPath('model-softdelete');
4749
}
4850

49-
return __DIR__.'/../stubs/model.stub';
51+
return $this->getStubPath('model');
5052
}
5153

5254
/**

src/Console/Commands/PageBackpackCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class PageBackpackCommand extends GeneratorCommand
99
{
1010
use \Backpack\CRUD\app\Console\Commands\Traits\PrettyCommandOutput;
11+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
1112

1213
/**
1314
* The console command name.
@@ -120,7 +121,7 @@ public function handle()
120121
*/
121122
protected function getStub()
122123
{
123-
return __DIR__.'/../stubs/page.stub';
124+
return $this->getStubPath('page');
124125
}
125126

126127
/**

src/Console/Commands/PageControllerBackpackCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class PageControllerBackpackCommand extends GeneratorCommand
1010
{
1111
use \Backpack\CRUD\app\Console\Commands\Traits\PrettyCommandOutput;
12+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
1213

1314
/**
1415
* The console command name.
@@ -111,7 +112,7 @@ protected function getPath($name)
111112
*/
112113
protected function getStub()
113114
{
114-
return __DIR__.'/../stubs/page-controller.stub';
115+
return $this->getStubPath('page-controller');
115116
}
116117

117118
/**

src/Console/Commands/RequestBackpackCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
class RequestBackpackCommand extends GeneratorCommand
88
{
9+
use \Backpack\Generators\Console\Commands\Traits\PublishableStubTrait;
10+
911
/**
1012
* The console command name.
1113
*
@@ -41,7 +43,7 @@ class RequestBackpackCommand extends GeneratorCommand
4143
*/
4244
protected function getStub()
4345
{
44-
return __DIR__.'/../stubs/request.stub';
46+
return $this->getStubPath('request');
4547
}
4648

4749
/**

0 commit comments

Comments
 (0)