1
<?php
2

3
namespace Nuwave\Lighthouse\Subscriptions;
4

5
use Illuminate\Auth\GuardHelpers;
6
use Illuminate\Contracts\Auth\Authenticatable;
7
use Illuminate\Contracts\Auth\Guard;
8
use RuntimeException;
9

10
class SubscriptionGuard implements Guard
11
{
12
    use GuardHelpers;
13

14
    public const GUARD_NAME = 'lighthouse_subscriptions';
15

16
    /**
17
     * The currently authenticated user.
18
     *
19
     * @var \Illuminate\Contracts\Auth\Authenticatable|null
20
     */
21
    protected $user;
22

23 0
    public function user(): ?Authenticatable
24
    {
25 0
        return $this->user;
26
    }
27

28 1
    public function reset(): void
29
    {
30 1
        $this->user = null;
31
    }
32

33
    /**
34
     * @param  array<mixed>  $credentials
35
     */
36 0
    public function validate(array $credentials = []): bool
37
    {
38 0
        throw new RuntimeException('The Lighthouse subscription guard cannot be used for credential based authentication.');
39
    }
40
}

Read our documentation on viewing source code .

Loading