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

orchestral / canvas / 6182179424

14 Sep 2023 07:15AM UTC coverage: 78.922% (-11.0%) from 89.945%
6182179424

Pull #24

github

web-flow
Merge 522effd92 into 63f8c0964
Pull Request #24: Use Laravel Generator Preset

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

161 of 204 relevant lines covered (78.92%)

5.91 hits per line

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

70.83
/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
     * Construct a new preset.
12
     *
13
     * @return void
14
     */
15
    public function __construct(protected Application $app)
16
    {
17
        parent::__construct('', $app->make('config'));
21✔
18
    }
19

20
    /**
21
     * Preset name.
22
     *
23
     * @return string
24
     */
25
    public function name()
26
    {
27
        return 'canvas';
×
28
    }
29

30
    /**
31
     * Preset has custom stub path.
32
     *
33
     * @return bool
34
     */
35
    public function hasCustomStubPath()
36
    {
37
        return false;
21✔
38
    }
39

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

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

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

70
    /**
71
     * Get the path to the vendor directory.
72
     *
73
     * @return string
74
     */
75
    public function vendorPath()
76
    {
77
        return $this->canvas()->vendorPath();
×
78
    }
79

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

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

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

110
    /**
111
     * Get the path to the seeder directory.
112
     *
113
     * @return string
114
     */
115
    public function seederPath()
116
    {
117
        return $this->canvas()->seederPath();
×
118
    }
119

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

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

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

150
    /**
151
     * Provider namespace.
152
     *
153
     * @return string
154
     */
155
    public function providerNamespace()
156
    {
157
        return $this->canvas()->providerNamespace().'\\';
×
158
    }
159

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

170
    /**
171
     * Database seeder namespace.
172
     *
173
     * @return string
174
     */
175
    public function seederNamespace()
176
    {
177
        return $this->canvas()->seederNamespace().'\\';
×
178
    }
179

180
    /**
181
     * Testing namespace.
182
     *
183
     * @return string
184
     */
185
    public function testingNamespace()
186
    {
187
        return $this->canvas()->testingNamespace().'\\';
12✔
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')) {
21✔
199
            return $this->canvas()->config('user-auth-model')
21✔
200
                ?? $this->canvas()->config('user-auth-provider')
21✔
201
                ?? parent::userProviderModel($guard);
21✔
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');
21✔
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