-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.php
50 lines (36 loc) · 1.03 KB
/
helpers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
use App\User;
if (! function_exists('flash')) {
/**
* @param $message
* @param string $type
*/
function flash($message, $type = 'success') {
session()->flash('message', $message);
session()->flash('message_type', $type);
}
}
if (! function_exists('sendMailNotifyToAdmin')) {
/**
* @param $mailView
*/
function sendMailNotifyToAdmin($mailView) {
$admin = User::where('email', env('ADMIN_EMAIL_FOR_NOTIFICATIONS'))->first();
if ($admin) {
$admin->notify($mailView);
}
}
}
if (! function_exists('pushNotification')) {
/**
* @param null $text
* @param null $title
* @return \App\Services\PushNotificationsService|mixed
*/
function pushNotification($text = null, $title = null) {
if (is_null($text) || is_null($title)) {
return app(\App\Services\PushNotificationsService::class);
}
return app(\App\Services\PushNotificationsService::class)->send($text, $title);
}
}