Mercurial > packages > framework
comparison src/Database/MySchema.php @ 2:b44434aaa767
Moving around the components.
Made a big step in the right direction with the Builder and named joins being accessible.
| author | luka |
|---|---|
| date | Wed, 18 Jun 2025 22:28:47 -0400 |
| parents | |
| children | 84c75d9d90be |
comparison
equal
deleted
inserted
replaced
| 1:56d9c64d64aa | 2:b44434aaa767 |
|---|---|
| 1 <?php | |
| 2 | |
| 3 namespace Libraries; | |
| 4 | |
| 5 use Illuminate\Database\Schema\Builder; | |
| 6 use Illuminate\Support\Facades\Schema as BaseSchema; | |
| 7 | |
| 8 class MySchema extends BaseSchema | |
| 9 { | |
| 10 /** | |
| 11 * Get a schema builder instance for a connection. | |
| 12 * | |
| 13 * @param string|null $name | |
| 14 */ | |
| 15 public static function connection($name): Builder | |
| 16 { | |
| 17 return self::customizedSchemaBuilder($name); | |
| 18 } | |
| 19 | |
| 20 /** | |
| 21 * Retrieves an instance of the schema `Builder` with a customized `Blueprint` class. | |
| 22 */ | |
| 23 public static function customizedSchemaBuilder(?string $name = null): Builder | |
| 24 { | |
| 25 /** @var Builder $builder */ | |
| 26 $builder = static::$app['db']->connection($name)->getSchemaBuilder(); | |
| 27 | |
| 28 $builder->blueprintResolver(static fn ($table, $callback, $prefix) => new MyBlueprint($table, $callback, $prefix)); | |
| 29 | |
| 30 return $builder; | |
| 31 } | |
| 32 } |
