Schema.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace Illuminate\Support\Facades;
  3. /**
  4. * @method static void defaultStringLength(int $length)
  5. * @method static void defaultTimePrecision(int|null $precision)
  6. * @method static void defaultMorphKeyType(string $type)
  7. * @method static void morphUsingUuids()
  8. * @method static void morphUsingUlids()
  9. * @method static bool createDatabase(string $name)
  10. * @method static bool dropDatabaseIfExists(string $name)
  11. * @method static array getSchemas()
  12. * @method static bool hasTable(string $table)
  13. * @method static bool hasView(string $view)
  14. * @method static array getTables(string|string[]|null $schema = null)
  15. * @method static array getTableListing(string|string[]|null $schema = null, bool $schemaQualified = true)
  16. * @method static array getViews(string|string[]|null $schema = null)
  17. * @method static array getTypes(string|string[]|null $schema = null)
  18. * @method static bool hasColumn(string $table, string $column)
  19. * @method static bool hasColumns(string $table, array $columns)
  20. * @method static void whenTableHasColumn(string $table, string $column, \Closure $callback)
  21. * @method static void whenTableDoesntHaveColumn(string $table, string $column, \Closure $callback)
  22. * @method static string getColumnType(string $table, string $column, bool $fullDefinition = false)
  23. * @method static array getColumnListing(string $table)
  24. * @method static array getColumns(string $table)
  25. * @method static array getIndexes(string $table)
  26. * @method static array getIndexListing(string $table)
  27. * @method static bool hasIndex(string $table, string|array $index, string|null $type = null)
  28. * @method static array getForeignKeys(string $table)
  29. * @method static void table(string $table, \Closure $callback)
  30. * @method static void create(string $table, \Closure $callback)
  31. * @method static void drop(string $table)
  32. * @method static void dropIfExists(string $table)
  33. * @method static void dropColumns(string $table, string|array $columns)
  34. * @method static void dropAllTables()
  35. * @method static void dropAllViews()
  36. * @method static void dropAllTypes()
  37. * @method static void rename(string $from, string $to)
  38. * @method static bool enableForeignKeyConstraints()
  39. * @method static bool disableForeignKeyConstraints()
  40. * @method static mixed withoutForeignKeyConstraints(\Closure $callback)
  41. * @method static string[]|null getCurrentSchemaListing()
  42. * @method static string|null getCurrentSchemaName()
  43. * @method static array parseSchemaAndTable(string $reference, string|bool|null $withDefaultSchema = null)
  44. * @method static \Illuminate\Database\Connection getConnection()
  45. * @method static void blueprintResolver(\Closure $resolver)
  46. * @method static void macro(string $name, object|callable $macro)
  47. * @method static void mixin(object $mixin, bool $replace = true)
  48. * @method static bool hasMacro(string $name)
  49. * @method static void flushMacros()
  50. *
  51. * @see \Illuminate\Database\Schema\Builder
  52. */
  53. class Schema extends Facade
  54. {
  55. /**
  56. * Indicates if the resolved facade should be cached.
  57. *
  58. * @var bool
  59. */
  60. protected static $cached = false;
  61. /**
  62. * Get a schema builder instance for a connection.
  63. *
  64. * @param string|null $name
  65. * @return \Illuminate\Database\Schema\Builder
  66. */
  67. public static function connection($name)
  68. {
  69. return static::$app['db']->connection($name)->getSchemaBuilder();
  70. }
  71. /**
  72. * Get the registered name of the component.
  73. *
  74. * @return string
  75. */
  76. protected static function getFacadeAccessor()
  77. {
  78. return 'db.schema';
  79. }
  80. }