• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

orchestral / canvas / 9563332959

18 Jun 2024 10:23AM UTC coverage: 94.815%. Remained the same
9563332959

push

github

crynobone
wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

640 of 675 relevant lines covered (94.81%)

24.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/Console/ObserverMakeCommand.php
1
<?php
2

3
namespace Orchestra\Canvas\Console;
4

5
use Illuminate\Filesystem\Filesystem;
6
use Orchestra\Canvas\Core\Concerns\CodeGenerator;
7
use Orchestra\Canvas\Core\Concerns\UsesGeneratorOverrides;
8
use Symfony\Component\Console\Attribute\AsCommand;
9

10
/**
11
 * @see https://github.com/laravel/framework/blob/10.x/src/Illuminate/Foundation/Console/ObserverMakeCommand.php
12
 */
13
#[AsCommand(name: 'make:observer', description: 'Create a new observer class')]
14
class ObserverMakeCommand extends \Illuminate\Foundation\Console\ObserverMakeCommand
15
{
16
    use CodeGenerator;
17
    use UsesGeneratorOverrides;
18

19
    /**
20
     * Create a new creator command instance.
21
     *
22
     * @return void
23
     */
24
    public function __construct(Filesystem $files)
25
    {
26
        parent::__construct($files);
3✔
27

28
        $this->addGeneratorPresetOptions();
3✔
29
    }
30

31
    /**
32
     * Execute the console command.
33
     *
34
     * @return bool|null
35
     *
36
     * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
37
     */
38
    #[\Override]
39
    public function handle()
40
    {
41
        /** @phpstan-ignore return.type */
42
        return $this->generateCode() ? self::SUCCESS : self::FAILURE;
3✔
43
    }
44

45
    /**
46
     * Qualify the given model class base name.
47
     *
48
     * @param  string  $model
49
     * @return string
50
     */
51
    #[\Override]
52
    protected function qualifyModel(string $model)
53
    {
54
        return $this->qualifyModelUsingCanvas($model);
2✔
55
    }
56

57
    /**
58
     * Get the destination class path.
59
     *
60
     * @param  string  $name
61
     * @return string
62
     */
63
    #[\Override]
64
    protected function getPath($name)
65
    {
66
        return $this->getPathUsingCanvas($name);
3✔
67
    }
68

69
    /**
70
     * Get the root namespace for the class.
71
     *
72
     * @return string
73
     */
74
    #[\Override]
75
    protected function rootNamespace()
76
    {
77
        return $this->rootNamespaceUsingCanvas();
3✔
78
    }
79

80
    /**
81
     * Get a list of possible model names.
82
     *
83
     * @return array<int, string>
84
     */
85
    #[\Override]
86
    protected function possibleModels()
87
    {
88
        return $this->possibleModelsUsingCanvas();
×
89
    }
90
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc