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

orchestral / canvas / 6185311258

14 Sep 2023 12:18PM UTC coverage: 86.458% (-3.5%) from 89.945%
6185311258

Pull #24

github

crynobone
wip

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

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

166 of 192 relevant lines covered (86.46%)

7.2 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

7
class GeneratorPreset extends Preset
8
{
9
    /**
10
     * Preset name.
11
     *
12
     * @return string
13
     */
14
    public function name()
15
    {
16
        return 'canvas';
2✔
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();
17✔
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();
6✔
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();
12✔
47
    }
48

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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