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

orchestral / canvas / 6222558446

18 Sep 2023 12:33PM UTC coverage: 91.007% (-2.9%) from 93.885%
6222558446

Pull #25

github

crynobone
wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Pull Request #25: Use `Illuminate\Console\GeneratorCommand`

549 of 549 new or added lines in 33 files covered. (100.0%)

506 of 556 relevant lines covered (91.01%)

25.62 hits per line

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

95.65
/src/GeneratorPreset.php
1
<?php
2

3
namespace Orchestra\Canvas;
4

5
use Orchestra\Canvas\Core\Presets\Preset;
6

7
class GeneratorPreset extends Preset
8
{
9
    /**
10
     * Preset name.
11
     *
12
     * @return string
13
     */
14
    public function name()
15
    {
16
        return 'canvas';
7✔
17
    }
18

19
    /**
20
     * Get the path to the base working directory.
21
     *
22
     * @return string
23
     */
24
    public function basePath()
25
    {
26
        return $this->canvas()->basePath();
23✔
27
    }
28

29
    /**
30
     * Get the path to the source directory.
31
     *
32
     * @return string
33
     */
34
    public function sourcePath()
35
    {
36
        return $this->canvas()->sourcePath();
71✔
37
    }
38

39
    /**
40
     * Get the path to the testing directory.
41
     *
42
     * @return string
43
     */
44
    public function testingPath()
45
    {
46
        return $this->canvas()->testingPath();
18✔
47
    }
48

49
    /**
50
     * Get the path to the resource directory.
51
     *
52
     * @return string
53
     */
54
    public function resourcePath()
55
    {
56
        return $this->canvas()->resourcePath();
4✔
57
    }
58

59
    /**
60
     * Get the path to the view directory.
61
     *
62
     * @return string
63
     */
64
    public function viewPath()
65
    {
66
        return implode('/', [$this->resourcePath(), 'views']);
4✔
67
    }
68

69
    /**
70
     * Get the path to the factory directory.
71
     *
72
     * @return string
73
     */
74
    public function factoryPath()
75
    {
76
        return $this->canvas()->factoryPath();
7✔
77
    }
78

79
    /**
80
     * Get the path to the migration directory.
81
     *
82
     * @return string
83
     */
84
    public function migrationPath()
85
    {
86
        return $this->canvas()->migrationPath();
7✔
87
    }
88

89
    /**
90
     * Get the path to the seeder directory.
91
     *
92
     * @return string
93
     */
94
    public function seederPath()
95
    {
96
        return $this->canvas()->seederPath();
4✔
97
    }
98

99
    /**
100
     * Preset namespace.
101
     *
102
     * @return string
103
     */
104
    public function rootNamespace()
105
    {
106
        return $this->canvas()->rootNamespace().'\\';
75✔
107
    }
108

109
    /**
110
     * Command namespace.
111
     *
112
     * @return string
113
     */
114
    public function commandNamespace()
115
    {
116
        return $this->canvas()->commandNamespace().'\\';
5✔
117
    }
118

119
    /**
120
     * Model namespace.
121
     *
122
     * @return string
123
     */
124
    public function modelNamespace()
125
    {
126
        return $this->canvas()->modelNamespace().'\\';
20✔
127
    }
128

129
    /**
130
     * Provider namespace.
131
     *
132
     * @return string
133
     */
134
    public function providerNamespace()
135
    {
136
        return $this->canvas()->providerNamespace().'\\';
2✔
137
    }
138

139
    /**
140
     * Database factory namespace.
141
     *
142
     * @return string
143
     */
144
    public function factoryNamespace()
145
    {
146
        return $this->canvas()->factoryNamespace().'\\';
7✔
147
    }
148

149
    /**
150
     * Database seeder namespace.
151
     *
152
     * @return string
153
     */
154
    public function seederNamespace()
155
    {
156
        return $this->canvas()->seederNamespace().'\\';
4✔
157
    }
158

159
    /**
160
     * Testing namespace.
161
     *
162
     * @return string
163
     */
164
    public function testingNamespace()
165
    {
166
        return $this->canvas()->testingNamespace().'\\';
18✔
167
    }
168

169
    /**
170
     * Preset has custom stub path.
171
     *
172
     * @return bool
173
     */
174
    public function hasCustomStubPath()
175
    {
176
        return ! \is_null($this->canvas()->getCustomStubPath());
29✔
177
    }
178

179
    /**
180
     * Get the model for the default guard's user provider.
181
     *
182
     * @param  string|null  $guard
183
     * @return string|null
184
     */
185
    public function userProviderModel($guard = null)
186
    {
187
        if (\is_null($guard) || $guard === $this->app->make('config')->get('auth.defaults.guard')) {
14✔
188
            return $this->canvas()->config('user-auth-model')
14✔
189
                ?? $this->canvas()->config('user-auth-provider')
14✔
190
                ?? parent::userProviderModel($guard);
14✔
191
        }
192

193
        return parent::userProviderModel($guard);
×
194
    }
195

196
    /**
197
     * Get canvas preset.
198
     *
199
     * @return \Orchestra\Canvas\Presets\Preset
200
     */
201
    public function canvas(): Presets\Preset
202
    {
203
        return $this->app->make('orchestra.canvas');
91✔
204
    }
205
}
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

© 2025 Coveralls, Inc