Bristol SU Support Package
src
ModuleInstance
Settings
SettingListener.php
Go to the documentation of this file.
1
<?php
2
3
namespace
BristolSU\Support\ModuleInstance\Settings
;
4
5
use
Illuminate\Bus\Queueable
;
6
use
Illuminate\Contracts\Queue\ShouldQueue
;
7
use
Illuminate\Foundation\Bus\Dispatchable
;
8
use
Illuminate\Queue\SerializesModels
;
9
13
abstract
class
SettingListener
implements
ShouldQueue
14
{
15
use
Dispatchable
,
SerializesModels
,
Queueable
;
16
22
protected
$key
;
23
31
public
function
handle
($event, $payload) {
32
$setting = $payload[0];
33
$eventName = substr(substr($event, 9), 0, -65);
34
if
($setting->key === $this->key) {
35
return
$this->
callEventFunction
($eventName, $setting);
36
}
37
return
false
;
38
}
39
48
private
function
callEventFunction
($eventName, $setting)
49
{
50
$method =
'on'
.ucfirst($eventName);
51
return
(method_exists($this, $method) ? $this->{$method}($setting) : null);
52
}
53
54
55
}
Dispatchable
ShouldQueue
BristolSU\Support\ModuleInstance\Settings\SettingListener\callEventFunction
callEventFunction($eventName, $setting)
Definition:
SettingListener.php:48
Queueable
BristolSU\Support\ModuleInstance\Settings\SettingListener
Definition:
SettingListener.php:13
Dispatchable
SerializesModels
BristolSU\Support\ModuleInstance\Settings\SettingListener\$key
$key
Definition:
SettingListener.php:22
BristolSU\Support\ModuleInstance\Settings
Definition:
ModuleInstanceSetting.php:3
BristolSU\Support\ModuleInstance\Settings\SettingListener\handle
handle($event, $payload)
Definition:
SettingListener.php:31
Queueable
SerializesModels
Generated by
1.8.13