|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Imanghafoori\HeyMan; |
|
4
|
|
|
|
|
5
|
|
|
use Imanghafoori\HeyMan\Normilizers\ActionNormalizer; |
|
6
|
|
|
use Imanghafoori\HeyMan\Normilizers\InputNormalizer; |
|
7
|
|
|
use Imanghafoori\HeyMan\WatchingStrategies\{ |
|
8
|
|
|
EloquentEventsManager, EventManager, RouterEventManager, ViewEventManager |
|
9
|
|
|
}; |
|
10
|
|
|
|
|
11
|
|
|
class Forget |
|
12
|
|
|
{ |
|
13
|
|
|
use ActionNormalizer, InputNormalizer; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Forget constructor. |
|
17
|
13 |
|
*/ |
|
18
|
|
|
public function __construct() |
|
19
|
13 |
|
{ |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function aboutView(...$view) |
|
23
|
|
|
{ |
|
24
|
|
|
resolve(ViewEventManager::class)->forgetAbout($this->normalizeInput($view)); |
|
25
|
13 |
|
} |
|
26
|
|
|
|
|
27
|
13 |
|
public function aboutSaving(...$model) |
|
28
|
|
|
{ |
|
29
|
4 |
|
$this->forgetAboutModel($model, 'saving'); |
|
30
|
|
|
} |
|
31
|
4 |
|
|
|
32
|
4 |
|
public function aboutDeleting(...$model) |
|
33
|
|
|
{ |
|
34
|
1 |
|
$this->forgetAboutModel($model, 'deleting'); |
|
35
|
|
|
} |
|
36
|
1 |
|
|
|
37
|
1 |
|
public function aboutFetching(...$model) |
|
38
|
|
|
{ |
|
39
|
1 |
|
$this->forgetAboutModel($model, 'retrieved'); |
|
40
|
|
|
} |
|
41
|
1 |
|
|
|
42
|
1 |
|
public function aboutCreating(...$model) |
|
43
|
|
|
{ |
|
44
|
1 |
|
$this->forgetAboutModel($model, 'creating'); |
|
45
|
|
|
} |
|
46
|
1 |
|
|
|
47
|
1 |
|
public function aboutUpdating(...$model) |
|
48
|
|
|
{ |
|
49
|
|
|
$this->forgetAboutModel($model, 'updating'); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function aboutModel(...$model) |
|
53
|
|
|
{ |
|
54
|
|
|
resolve(EloquentEventsManager::class)->forgetAbout($this->normalizeInput($model)); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function aboutEvent(...$events) |
|
58
|
|
|
{ |
|
59
|
1 |
|
resolve(EventManager::class)->forgetAbout($this->normalizeInput($events)); |
|
60
|
|
|
} |
|
61
|
1 |
|
|
|
62
|
1 |
|
public function aboutUrl(...$urls) |
|
63
|
|
|
{ |
|
64
|
2 |
|
$this->forgetAboutRoute($this->normalizeUrl($urls, 'GET')); |
|
65
|
|
|
} |
|
66
|
2 |
|
|
|
67
|
2 |
|
public function aboutRoute(...$route) |
|
68
|
|
|
{ |
|
69
|
1 |
|
$this->forgetAboutRoute($this->normalizeInput($route)); |
|
70
|
|
|
} |
|
71
|
1 |
|
|
|
72
|
1 |
|
public function aboutAction(...$actions) |
|
73
|
|
|
{ |
|
74
|
1 |
|
$this->forgetAboutRoute($this->normalizeAction($actions)); |
|
75
|
|
|
} |
|
76
|
1 |
|
|
|
77
|
1 |
|
/** |
|
78
|
|
|
* @param $model |
|
79
|
1 |
|
* @param $event |
|
80
|
|
|
*/ |
|
81
|
1 |
|
private function forgetAboutModel($model, $event) |
|
82
|
1 |
|
{ |
|
83
|
|
|
resolve(EloquentEventsManager::class)->forgetAbout($this->normalizeInput($model), $event); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @param $normalizeUrl |
|
88
|
|
|
*/ |
|
89
|
|
|
private function forgetAboutRoute($normalizeUrl) |
|
90
|
1 |
|
{ |
|
91
|
|
|
resolve(RouterEventManager::class)->forgetAbout($normalizeUrl); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|