Skip to content

Commit 43de285

Browse files
author
Kurt Friars
committed
Merge branch 'main' into 10.x
2 parents 7a2947b + 2f53592 commit 43de285

File tree

6 files changed

+9
-49
lines changed

6 files changed

+9
-49
lines changed

config/schema-events.php

-25
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,6 @@
2929
'finished' => MigrationsFinished::class,
3030
],
3131

32-
/*
33-
|--------------------------------------------------------------------------
34-
| Listeners
35-
|--------------------------------------------------------------------------
36-
|
37-
| `created`:
38-
| The event emitted when tables are created during migrations.
39-
|
40-
| `changed`:
41-
| The event emitted when tables are altered during migrations.
42-
|
43-
| `renamed`:
44-
| The event emitted when tables are renamed during migrations.
45-
|
46-
| `dropped`:
47-
| The event emitted when tables are dropped during migrations.
48-
|
49-
*/
50-
'events' => [
51-
'created' => TableCreated::class,
52-
'changed' => TableChanged::class,
53-
'renamed' => TableRenamed::class,
54-
'dropped' => TableDropped::class,
55-
],
56-
5732
/*
5833
|--------------------------------------------------------------------------
5934
| Commands

src/Concerns/ListensToSchemaEvents.php

+5-20
Original file line numberDiff line numberDiff line change
@@ -37,46 +37,31 @@ public function create($table, Closure $callback)
3737
{
3838
$blueprint = $this->createBlueprint($table, $callback);
3939

40-
/** @var class-string<TableCreated> $event */
41-
$event = config()->get('schema-events.events.created');
42-
43-
$this->events->push($event::from($this->connection, $blueprint));
40+
$this->events->push(TableCreated::from($this->connection, $blueprint));
4441
}
4542

4643
public function drop($table)
4744
{
48-
/** @var class-string<TableDropped> $event */
49-
$event = config()->get('schema-events.events.dropped');
50-
51-
$this->events->push($event::from($this->connection, $table));
45+
$this->events->push(TableDropped::from($this->connection, $table));
5246
}
5347

5448
public function dropIfExists($table)
5549
{
5650
if ($this->hasTable($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));
51+
$this->events->push(TableDropped::from($this->connection, $table));
6152
}
6253
}
6354

6455
public function table($table, Closure $callback)
6556
{
6657
$blueprint = $this->createBlueprint($table, $callback);
6758

68-
/** @var class-string<TableChanged> $event */
69-
$event = config()->get('schema-events.events.changed');
70-
71-
$this->events->push($event::from($this->connection, $blueprint));
59+
$this->events->push(TableChanged::from($this->connection, $blueprint));
7260
}
7361

7462
public function rename($from, $to)
7563
{
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));
64+
$this->events->push(TableRenamed::from($this->connection, $from, $to));
8065
}
8166

8267
public function hasTable($table)

src/Events/TableChanged.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @property Collection<string> $addedForeignKeys
1919
* @property Collection<string> $droppedForeignKeys
2020
*/
21-
readonly class TableChanged
21+
final readonly class TableChanged
2222
{
2323
use ParsesBlueprint;
2424

src/Events/TableCreated.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @property Collection<string> $indexes
1313
* @property Collection<string> $foreignKeys
1414
*/
15-
readonly class TableCreated
15+
final readonly class TableCreated
1616
{
1717
use ParsesBlueprint;
1818

src/Events/TableDropped.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Database\Connection;
66

7-
readonly class TableDropped
7+
final readonly class TableDropped
88
{
99
public function __construct(
1010
public string $connection,

src/Events/TableRenamed.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Database\Connection;
66

7-
readonly class TableRenamed
7+
final readonly class TableRenamed
88
{
99
public function __construct(
1010
public string $connection,

0 commit comments

Comments
 (0)