1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Arcanedev\Notify\Contracts; |
6
|
|
|
|
7
|
|
|
use Illuminate\Support\Collection; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Interface Notify |
11
|
|
|
* |
12
|
|
|
* @author ARCANEDEV <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
interface Notify |
15
|
|
|
{ |
16
|
|
|
/* ----------------------------------------------------------------- |
17
|
|
|
| Getters & Setters |
18
|
|
|
| ----------------------------------------------------------------- |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Get the store. |
23
|
|
|
* |
24
|
|
|
* @return \Arcanedev\Notify\Contracts\Store |
25
|
|
|
*/ |
26
|
|
|
public function store(): Store; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Set the store. |
30
|
|
|
* |
31
|
|
|
* @param \Arcanedev\Notify\Contracts\Store $store |
32
|
|
|
* |
33
|
|
|
* @return $this |
34
|
|
|
*/ |
35
|
|
|
public function setStore(Store $store); |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Get all the notifications. |
39
|
|
|
* |
40
|
|
|
* @return \Illuminate\Support\Collection |
41
|
|
|
*/ |
42
|
|
|
public function notifications(): Collection; |
43
|
|
|
|
44
|
|
|
/* ----------------------------------------------------------------- |
45
|
|
|
| Main Methods |
46
|
|
|
| ----------------------------------------------------------------- |
47
|
|
|
*/ |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Flash an information message. |
51
|
|
|
* |
52
|
|
|
* @param string $message |
53
|
|
|
* @param array $extra |
54
|
|
|
* |
55
|
|
|
* @return $this |
56
|
|
|
*/ |
57
|
|
|
public function info(string $message, array $extra = []); |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Flash a success message. |
61
|
|
|
* |
62
|
|
|
* @param string $message |
63
|
|
|
* @param array $extra |
64
|
|
|
* |
65
|
|
|
* @return $this |
66
|
|
|
*/ |
67
|
|
|
public function success(string $message, array $extra = []); |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Flash an error message. |
71
|
|
|
* |
72
|
|
|
* @param string $message |
73
|
|
|
* @param array $extra |
74
|
|
|
* |
75
|
|
|
* @return $this |
76
|
|
|
*/ |
77
|
|
|
public function error(string $message, array $extra = []); |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Flash a warning message. |
81
|
|
|
* |
82
|
|
|
* @param string $message |
83
|
|
|
* @param array $extra |
84
|
|
|
* |
85
|
|
|
* @return $this |
86
|
|
|
*/ |
87
|
|
|
public function warning(string $message, array $extra = []); |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Flash a new notification. |
91
|
|
|
* |
92
|
|
|
* @param string $message |
93
|
|
|
* @param string|null $type |
94
|
|
|
* @param array $extra |
95
|
|
|
* |
96
|
|
|
* @return $this |
97
|
|
|
*/ |
98
|
|
|
public function flash($message, $type = 'info', array $extra = []); |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Forget the notification. |
102
|
|
|
* |
103
|
|
|
* @return void |
104
|
|
|
*/ |
105
|
|
|
public function forget(); |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Check if it has notifications. |
109
|
|
|
* |
110
|
|
|
* @return bool |
111
|
|
|
*/ |
112
|
|
|
public function isEmpty(): bool; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Check if there is no notifications. |
116
|
|
|
* |
117
|
|
|
* @return bool |
118
|
|
|
*/ |
119
|
|
|
public function isNotEmpty(): bool; |
120
|
|
|
} |
121
|
|
|
|