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

mpyw / scoped-auth / 13674344544

05 Mar 2025 10:54AM UTC coverage: 100.0%. Remained the same
13674344544

push

github

mpyw
wip

12 of 12 relevant lines covered (100.0%)

32.0 hits per line

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

100.0
/src/ScopedAuthServiceProvider.php
1
<?php
2

3
namespace Mpyw\ScopedAuth;
4

5
use Closure;
6
use Illuminate\Auth\AuthManager;
7
use Illuminate\Contracts\Container\Container;
8
use Illuminate\Support\ServiceProvider;
9

10
class ScopedAuthServiceProvider extends ServiceProvider
11
{
12
    public function register(): void
13
    {
14
        /* @noinspection PhpUnhandledExceptionInspection */
15
        $this->app->resolved(AuthManager::class)
56✔
16
            ? static::overrideEloquentUserProvider($this->app->make(AuthManager::class)) // @codeCoverageIgnore
17
            : $this->app->afterResolving(AuthManager::class, Closure::fromCallable([$this, 'overrideEloquentUserProvider']));
56✔
18
    }
19

20
    protected function overrideEloquentUserProvider(AuthManager $auth): void
21
    {
22
        $auth->provider('eloquent', function (Container $app, array $config) {
16✔
23
            return $app->make(ScopedEloquentUserProvider::class, [
16✔
24
                'model' => $config['model'],
16✔
25
            ]);
16✔
26
        });
16✔
27
    }
28
}
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