Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Foundation\Console;
4
 
5
use Illuminate\Console\GeneratorCommand;
6
use Symfony\Component\Console\Attribute\AsCommand;
7
use Symfony\Component\Console\Input\InputOption;
8
 
9
#[AsCommand(name: 'make:channel')]
10
class ChannelMakeCommand extends GeneratorCommand
11
{
12
    /**
13
     * The console command name.
14
     *
15
     * @var string
16
     */
17
    protected $name = 'make:channel';
18
 
19
    /**
20
     * The name of the console command.
21
     *
22
     * This name is used to identify the command during lazy loading.
23
     *
24
     * @var string|null
25
     *
26
     * @deprecated
27
     */
28
    protected static $defaultName = 'make:channel';
29
 
30
    /**
31
     * The console command description.
32
     *
33
     * @var string
34
     */
35
    protected $description = 'Create a new channel class';
36
 
37
    /**
38
     * The type of class being generated.
39
     *
40
     * @var string
41
     */
42
    protected $type = 'Channel';
43
 
44
    /**
45
     * Build the class with the given name.
46
     *
47
     * @param  string  $name
48
     * @return string
49
     */
50
    protected function buildClass($name)
51
    {
52
        return str_replace(
53
            ['DummyUser', '{{ userModel }}'],
54
            class_basename($this->userProviderModel()),
55
            parent::buildClass($name)
56
        );
57
    }
58
 
59
    /**
60
     * Get the stub file for the generator.
61
     *
62
     * @return string
63
     */
64
    protected function getStub()
65
    {
66
        return __DIR__.'/stubs/channel.stub';
67
    }
68
 
69
    /**
70
     * Get the default namespace for the class.
71
     *
72
     * @param  string  $rootNamespace
73
     * @return string
74
     */
75
    protected function getDefaultNamespace($rootNamespace)
76
    {
77
        return $rootNamespace.'\Broadcasting';
78
    }
79
 
80
    /**
81
     * Get the console command arguments.
82
     *
83
     * @return array
84
     */
85
    protected function getOptions()
86
    {
87
        return [
88
            ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the channel already exists'],
89
        ];
90
    }
91
}