1 | <?php |
||
16 | class SessionStore implements Store |
||
17 | { |
||
18 | /* ----------------------------------------------------------------- |
||
19 | | Properties |
||
20 | | ----------------------------------------------------------------- |
||
21 | */ |
||
22 | |||
23 | /** |
||
24 | * The Illuminate Session instance. |
||
25 | * |
||
26 | * @var \Illuminate\Contracts\Session\Session |
||
27 | */ |
||
28 | private $session; |
||
29 | |||
30 | /** |
||
31 | * The store's options. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $options; |
||
36 | |||
37 | /* ----------------------------------------------------------------- |
||
38 | | Constructor |
||
39 | | ----------------------------------------------------------------- |
||
40 | */ |
||
41 | |||
42 | /** |
||
43 | * Make session store instance. |
||
44 | * |
||
45 | * @param \Illuminate\Contracts\Session\Session $session |
||
46 | * @param array $options |
||
47 | */ |
||
48 | 52 | public function __construct(SessionContract $session, array $options) |
|
53 | |||
54 | /* ----------------------------------------------------------------- |
||
55 | | Getters |
||
56 | | ----------------------------------------------------------------- |
||
57 | */ |
||
58 | |||
59 | /** |
||
60 | * Get the session key. |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | 52 | protected function getSessionKey(): string |
|
68 | |||
69 | /* ----------------------------------------------------------------- |
||
70 | | Main Methods |
||
71 | | ----------------------------------------------------------------- |
||
72 | */ |
||
73 | |||
74 | /** |
||
75 | * Get all the notifications. |
||
76 | * |
||
77 | * @return \Illuminate\Support\Collection |
||
78 | */ |
||
79 | 52 | public function all(): Collection |
|
85 | |||
86 | /** |
||
87 | * Push the new notification. |
||
88 | * |
||
89 | * @param array $notification |
||
90 | */ |
||
91 | 40 | public function push(array $notification) |
|
98 | |||
99 | /** |
||
100 | * Forget the notifications. |
||
101 | */ |
||
102 | 8 | public function forget(): void |
|
106 | |||
107 | /** |
||
108 | * Check if it has notifications. |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | 44 | public function isEmpty(): bool |
|
116 | |||
117 | /** |
||
118 | * Check if there is no notifications. |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | 44 | public function isNotEmpty(): bool |
|
126 | } |
||
127 |