-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSubscribableApplicationServiceProvider.php
More file actions
102 lines (85 loc) · 2.82 KB
/
Copy pathSubscribableApplicationServiceProvider.php
File metadata and controls
102 lines (85 loc) · 2.82 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
namespace YlsIdeas\SubscribableNotifications;
use Illuminate\Support\ServiceProvider;
/**
* @deprecated v1.x will be removed in v2.0. Publish the subscriber-provider stub and configure
* Subscriber callbacks directly in your own service provider's boot() method instead.
* See the upgrade guide: UPGRADE.md
*/
abstract class SubscribableApplicationServiceProvider extends ServiceProvider
{
/**
* @var bool
*/
protected $loadRoutes = true;
/**
* @var string
*/
protected $model = null;
public function boot()
{
trigger_error(
sprintf(
'%s is deprecated and will be removed in v2.0. Publish the subscriber-provider stub'
. ' and configure Subscriber callbacks directly in your boot() method instead.',
static::class
),
E_USER_DEPRECATED
);
if ($this->loadRoutes === true) {
$this->loadRoutes();
}
\YlsIdeas\SubscribableNotifications\Facades\Subscriber::userModel(
$this->userModel()
);
\YlsIdeas\SubscribableNotifications\Facades\Subscriber::onUnsubscribeFromMailingList(
$this->onUnsubscribeFromMailingList()
);
\YlsIdeas\SubscribableNotifications\Facades\Subscriber::onUnsubscribeFromAllMailingLists(
$this->onUnsubscribeFromAllMailingLists()
);
\YlsIdeas\SubscribableNotifications\Facades\Subscriber::onCompletion(
$this->onCompletion()
);
\YlsIdeas\SubscribableNotifications\Facades\Subscriber::onCheckSubscriptionStatusOfMailingList(
$this->onCheckSubscriptionStatusOfMailingList()
);
\YlsIdeas\SubscribableNotifications\Facades\Subscriber::onCheckSubscriptionStatusOfAllMailingLists(
$this->onCheckSubscriptionStatusOfAllMailingLists()
);
}
protected function userModel()
{
if ($this->model != null) {
return $this->model;
}
if (version_compare($this->app->version(), '8.0.0', '>=')) {
return '\App\Models\User';
}
return '\App\User';
}
public function loadRoutes()
{
\YlsIdeas\SubscribableNotifications\Facades\Subscriber::routes();
}
/**
* @return callable|string
*/
abstract public function onUnsubscribeFromMailingList();
/**
* @return callable|string
*/
abstract public function onUnsubscribeFromAllMailingLists();
/**
* @return callable|string
*/
abstract public function onCompletion();
/**
* @return callable|string
*/
abstract public function onCheckSubscriptionStatusOfMailingList();
/**
* @return callable|string
*/
abstract public function onCheckSubscriptionStatusOfAllMailingLists();
}