blob: 2796f1ae6a9a906e8eda075756faa3f49bc8cab5 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Illuminate\Contracts\Auth;
4
5interface Guard
6{
7 /**
8 * Determine if the current user is authenticated.
9 *
10 * @return bool
11 */
12 public function check();
13
14 /**
15 * Determine if the current user is a guest.
16 *
17 * @return bool
18 */
19 public function guest();
20
21 /**
22 * Get the currently authenticated user.
23 *
24 * @return \Illuminate\Contracts\Auth\Authenticatable|null
25 */
26 public function user();
27
28 /**
29 * Get the ID for the currently authenticated user.
30 *
31 * @return int|string|null
32 */
33 public function id();
34
35 /**
36 * Validate a user's credentials.
37 *
38 * @param array $credentials
39 * @return bool
40 */
41 public function validate(array $credentials = []);
42
43 /**
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010044 * Determine if the guard has a user instance.
45 *
46 * @return bool
47 */
48 public function hasUser();
49
50 /**
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020051 * Set the current user.
52 *
53 * @param \Illuminate\Contracts\Auth\Authenticatable $user
54 * @return void
55 */
56 public function setUser(Authenticatable $user);
57}