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

orchestral / canvas-core / 13260357962

11 Feb 2025 10:04AM UTC coverage: 83.453%. Remained the same
13260357962

push

github

crynobone
wip

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

1 of 2 new or added lines in 1 file covered. (50.0%)

116 of 139 relevant lines covered (83.45%)

2.78 hits per line

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

85.71
/src/Presets/Preset.php
1
<?php
2

3
namespace Orchestra\Canvas\Core\Presets;
4

5
use Illuminate\Contracts\Foundation\Application;
6
use LogicException;
7

8
abstract class Preset
9
{
10
    /**
11
     * Construct a new preset.
12
     *
13
     * @return void
14
     */
15
    public function __construct(
16
        protected Application $app
17
    ) {}
9✔
18

19
    /**
20
     * Check if preset name equal to $name.
21
     */
22
    public function is(string $name): bool
23
    {
24
        return $this->name() === $name;
2✔
25
    }
26

27
    /**
28
     * Get the model for the default guard's user provider.
29
     *
30
     * @return class-string|null
31
     *
32
     * @throws \LogicException
33
     */
34
    public function userProviderModel(?string $guard = null): ?string
35
    {
36
        /** @var \Illuminate\Contracts\Config\Repository $config */
37
        $config = $this->app->make('config');
5✔
38

39
        $guard = $guard ?: $config->get('auth.defaults.guard');
5✔
40

41
        if (\is_null($provider = $config->get("auth.guards.{$guard}.provider"))) {
5✔
NEW
42
            throw new LogicException(sprintf('The [%s] guard is not defined in your "auth" configuration file.', $guard));
×
43
        }
44

45
        return $config->get("auth.providers.{$provider}.model");
5✔
46
    }
47

48
    /**
49
     * Preset name.
50
     */
51
    abstract public function name(): string;
52

53
    /**
54
     * Get the path to the base working directory.
55
     */
56
    abstract public function basePath(): string;
57

58
    /**
59
     * Get the path to the source directory.
60
     */
61
    abstract public function sourcePath(): string;
62

63
    /**
64
     * Get the path to the testing directory.
65
     */
66
    abstract public function testingPath(): string;
67

68
    /**
69
     * Get the path to the resource directory.
70
     */
71
    abstract public function resourcePath(): string;
72

73
    /**
74
     * Get the path to the view directory.
75
     */
76
    abstract public function viewPath(): string;
77

78
    /**
79
     * Get the path to the factory directory.
80
     */
81
    abstract public function factoryPath(): string;
82

83
    /**
84
     * Get the path to the migration directory.
85
     */
86
    abstract public function migrationPath(): string;
87

88
    /**
89
     * Get the path to the seeder directory.
90
     */
91
    abstract public function seederPath(): string;
92

93
    /**
94
     * Preset namespace.
95
     */
96
    abstract public function rootNamespace(): string;
97

98
    /**
99
     * Command namespace.
100
     */
101
    abstract public function commandNamespace(): string;
102

103
    /**
104
     * Model namespace.
105
     */
106
    abstract public function modelNamespace(): string;
107

108
    /**
109
     * Provider namespace.
110
     */
111
    abstract public function providerNamespace(): string;
112

113
    /**
114
     * Testing namespace.
115
     */
116
    abstract public function testingNamespace(): string;
117

118
    /**
119
     * Database factory namespace.
120
     */
121
    abstract public function factoryNamespace(): string;
122

123
    /**
124
     * Database seeder namespace.
125
     */
126
    abstract public function seederNamespace(): string;
127

128
    /**
129
     * Preset has custom stub path.
130
     */
131
    abstract public function hasCustomStubPath(): bool;
132
}
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