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

orchestral / canvas / 6185061391

14 Sep 2023 11:56AM UTC coverage: 85.128% (-4.8%) from 89.945%
6185061391

Pull #24

github

crynobone
wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Pull Request #24: Use Laravel Generator Preset

176 of 176 new or added lines in 11 files covered. (100.0%)

166 of 195 relevant lines covered (85.13%)

7.09 hits per line

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

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

3
namespace Orchestra\Canvas;
4

5
use Illuminate\Console\Generators\Presets\Preset;
6
use Illuminate\Contracts\Foundation\Application;
7

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

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

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

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

50
    /**
51
     * Get the path to the vendor directory.
52
     *
53
     * @return string
54
     */
55
    public function vendorPath()
56
    {
57
        return $this->canvas()->vendorPath();
×
58
    }
59

60
    /**
61
     * Get the path to the resource directory.
62
     *
63
     * @return string
64
     */
65
    public function resourcePath()
66
    {
67
        return $this->canvas()->resourcePath();
4✔
68
    }
69

70
    /**
71
     * Get the path to the view directory.
72
     *
73
     * @return string
74
     */
75
    public function viewPath()
76
    {
77
        return implode('/', [$this->resourcePath(), 'views']);
4✔
78
    }
79

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

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

100
    /**
101
     * Get the path to the seeder directory.
102
     *
103
     * @return string
104
     */
105
    public function seederPath()
106
    {
107
        return $this->canvas()->seederPath();
2✔
108
    }
109

110
    /**
111
     * Preset namespace.
112
     *
113
     * @return string
114
     */
115
    public function rootNamespace()
116
    {
117
        return $this->canvas()->rootNamespace().'\\';
12✔
118
    }
119

120
    /**
121
     * Command namespace.
122
     *
123
     * @return string
124
     */
125
    public function commandNamespace()
126
    {
127
        return $this->canvas()->commandNamespace().'\\';
5✔
128
    }
129

130
    /**
131
     * Model namespace.
132
     *
133
     * @return string
134
     */
135
    public function modelNamespace()
136
    {
137
        return $this->canvas()->modelNamespace().'\\';
6✔
138
    }
139

140
    /**
141
     * Provider namespace.
142
     *
143
     * @return string
144
     */
145
    public function providerNamespace()
146
    {
147
        return $this->canvas()->providerNamespace().'\\';
2✔
148
    }
149

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

160
    /**
161
     * Database seeder namespace.
162
     *
163
     * @return string
164
     */
165
    public function seederNamespace()
166
    {
167
        return $this->canvas()->seederNamespace().'\\';
2✔
168
    }
169

170
    /**
171
     * Testing namespace.
172
     *
173
     * @return string
174
     */
175
    public function testingNamespace()
176
    {
177
        return $this->canvas()->testingNamespace().'\\';
12✔
178
    }
179

180
    /**
181
     * Preset has custom stub path.
182
     *
183
     * @return bool
184
     */
185
    public function hasCustomStubPath()
186
    {
187
        return ! is_null($this->canvas()->getCustomStubPath());
23✔
188
    }
189

190
    /**
191
     * Get the model for the default guard's user provider.
192
     *
193
     * @param  string|null  $guard
194
     * @return string|null
195
     */
196
    public function userProviderModel($guard = null)
197
    {
198
        if (\is_null($guard) || $guard === $this->config->get('auth.defaults.guard')) {
23✔
199
            return $this->canvas()->config('user-auth-model')
23✔
200
                ?? $this->canvas()->config('user-auth-provider')
23✔
201
                ?? parent::userProviderModel($guard);
23✔
202
        }
203

204
        return parent::userProviderModel($guard);
×
205
    }
206

207
    /**
208
     * Get canvas preset.
209
     *
210
     * @return \Orchestra\Canvas\Presets\Preset
211
     */
212
    public function canvas(): Presets\Preset
213
    {
214
        return $this->app->make('orchestra.canvas');
23✔
215
    }
216
}
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