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\Routing\Console;
4
 
5
use Illuminate\Console\Concerns\CreatesMatchingTest;
6
use Illuminate\Console\GeneratorCommand;
7
use Symfony\Component\Console\Attribute\AsCommand;
8
 
9
#[AsCommand(name: 'make:middleware')]
10
class MiddlewareMakeCommand extends GeneratorCommand
11
{
12
    use CreatesMatchingTest;
13
 
14
    /**
15
     * The console command name.
16
     *
17
     * @var string
18
     */
19
    protected $name = 'make:middleware';
20
 
21
    /**
22
     * The name of the console command.
23
     *
24
     * This name is used to identify the command during lazy loading.
25
     *
26
     * @var string|null
27
     *
28
     * @deprecated
29
     */
30
    protected static $defaultName = 'make:middleware';
31
 
32
    /**
33
     * The console command description.
34
     *
35
     * @var string
36
     */
37
    protected $description = 'Create a new middleware class';
38
 
39
    /**
40
     * The type of class being generated.
41
     *
42
     * @var string
43
     */
44
    protected $type = 'Middleware';
45
 
46
    /**
47
     * Get the stub file for the generator.
48
     *
49
     * @return string
50
     */
51
    protected function getStub()
52
    {
53
        return $this->resolveStubPath('/stubs/middleware.stub');
54
    }
55
 
56
    /**
57
     * Resolve the fully-qualified path to the stub.
58
     *
59
     * @param  string  $stub
60
     * @return string
61
     */
62
    protected function resolveStubPath($stub)
63
    {
64
        return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
65
            ? $customPath
66
            : __DIR__.$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.'\Http\Middleware';
78
    }
79
}