@@ -37,31 +37,46 @@ public function create($table, Closure $callback)
37
37
{
38
38
$ blueprint = $ this ->createBlueprint ($ table , $ callback );
39
39
40
- $ this ->events ->push (TableCreated::from ($ this ->connection , $ blueprint ));
40
+ /** @var class-string<TableCreated> $event */
41
+ $ event = config ()->get ('schema-events.events.created ' );
42
+
43
+ $ this ->events ->push ($ event ::from ($ this ->connection , $ blueprint ));
41
44
}
42
45
43
46
public function drop ($ table )
44
47
{
45
- $ this ->events ->push (TableDropped::from ($ this ->connection , $ table ));
48
+ /** @var class-string<TableDropped> $event */
49
+ $ event = config ()->get ('schema-events.events.dropped ' );
50
+
51
+ $ this ->events ->push ($ event ::from ($ this ->connection , $ table ));
46
52
}
47
53
48
54
public function dropIfExists ($ table )
49
55
{
50
56
if ($ this ->hasTable ($ table )) {
51
- $ this ->events ->push (TableDropped::from ($ this ->connection , $ table ));
57
+ /** @var class-string<TableDropped> $event */
58
+ $ event = config ()->get ('schema-events.events.dropped ' );
59
+
60
+ $ this ->events ->push ($ event ::from ($ this ->connection , $ table ));
52
61
}
53
62
}
54
63
55
64
public function table ($ table , Closure $ callback )
56
65
{
57
66
$ blueprint = $ this ->createBlueprint ($ table , $ callback );
58
67
59
- $ this ->events ->push (TableChanged::from ($ this ->connection , $ blueprint ));
68
+ /** @var class-string<TableChanged> $event */
69
+ $ event = config ()->get ('schema-events.events.changed ' );
70
+
71
+ $ this ->events ->push ($ event ::from ($ this ->connection , $ blueprint ));
60
72
}
61
73
62
74
public function rename ($ from , $ to )
63
75
{
64
- $ this ->events ->push (TableRenamed::from ($ this ->connection , $ from , $ to ));
76
+ /** @var class-string<TableCreated> $event */
77
+ $ event = config ()->get ('schema-events.events.renamed ' );
78
+
79
+ $ this ->events ->push ($ event ::from ($ this ->connection , $ from , $ to ));
65
80
}
66
81
67
82
public function hasTable ($ table )
0 commit comments