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

Commit e1ee336

Browse files
author
atehnix
committed
Add make:channel command
1 parent 46bd3a9 commit e1ee336

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/Console/ChannelMakeCommand.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* This file is part of laravel-stubs package.
4+
*
5+
* @author ATehnix <atehnix@gmail.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace ATehnix\LaravelStubs\Console;
12+
13+
use Illuminate\Foundation\Console\ChannelMakeCommand as BaseChannelMakeCommand;
14+
15+
class ChannelMakeCommand extends BaseChannelMakeCommand
16+
{
17+
/**
18+
* Get the stub file for the generator.
19+
*
20+
* @return string
21+
*/
22+
protected function getStub()
23+
{
24+
$stub = config('stubs.path') . '/channel.stub';
25+
26+
return file_exists($stub) ? $stub : parent::getStub();
27+
}
28+
29+
/**
30+
* Get the default namespace for the class.
31+
*
32+
* @param string $rootNamespace
33+
* @return string
34+
*/
35+
protected function getDefaultNamespace($rootNamespace)
36+
{
37+
return $rootNamespace . config('stubs.namespaces.channel');
38+
}
39+
}

src/Providers/ArtisanServiceProvider.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace ATehnix\LaravelStubs\Providers;
1212

13+
use ATehnix\LaravelStubs\Console\ChannelMakeCommand;
1314
use ATehnix\LaravelStubs\Console\ConsoleMakeCommand;
1415
use ATehnix\LaravelStubs\Console\ControllerMakeCommand;
1516
use ATehnix\LaravelStubs\Console\EventMakeCommand;
@@ -43,6 +44,18 @@ public function boot()
4344
$this->commands(StubsPublishCommand::class);
4445
}
4546

47+
/**
48+
* Register the command.
49+
*
50+
* @return void
51+
*/
52+
protected function registerChannelMakeCommand()
53+
{
54+
$this->app->singleton('command.channel.make', function ($app) {
55+
return new ChannelMakeCommand($app['files']);
56+
});
57+
}
58+
4659
/**
4760
* Register the command.
4861
*

0 commit comments

Comments
 (0)