Mercurial > packages > framework
annotate src/Database/MySchema.php @ 7:e6132a1e8e24 default tip
Adding better support for test among other base changes.
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Thu, 25 Sep 2025 19:58:32 -0400 |
| parents | 84c75d9d90be |
| children |
| rev | line source |
|---|---|
| 2 | 1 <?php |
| 2 | |
|
4
84c75d9d90be
Changing usage to be bootstrap 5, not everything is reviewed but it's been started
luka
parents:
2
diff
changeset
|
3 namespace Wizard\Framework\Database; |
| 2 | 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 } |
