函数(蓝图$table),$table是一个variable/property/对象吗???哪个class的对象/variable/property?

function (Blueprint $table), Is $table a variable/property / object??? Which class's object/ variable/property?

Schema::create('flights', function (Blueprint $table) { $table->增量('id'); $table ->字符串('name'); $table->字符串('airline'); $table->timestamps(); });

嗯,$table\Illuminate\Database\Schema\Blueprint 的一个实例,可以在这里找到:vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php

所有可用的方法都可以在class中找到。

只是为了证明,这里是class:Log::info(get_class($table);

结果[2022-04-06 10:09:52] local.INFO: Illuminate\Database\Schema\Blueprint

以下是可用方法的结果:Log::info(json_encode(get_class_methods($table)));

结果:

[
  "__construct",
  "build",
  "toSql",
  "addFluentCommands",
  "creating",
  "create",
  "temporary",
  "drop",
  "dropIfExists",
  "dropColumn",
  "renameColumn",
  "dropPrimary",
  "dropUnique",
  "dropIndex",
  "dropFullText",
  "dropSpatialIndex",
  "dropForeign",
  "dropConstrainedForeignId",
  "renameIndex",
  "dropTimestamps",
  "dropTimestampsTz",
  "dropSoftDeletes",
  "dropSoftDeletesTz",
  "dropRememberToken",
  "dropMorphs",
  "rename",
  "primary",
  "unique",
  "index",
  "fullText",
  "spatialIndex",
  "rawIndex",
  "foreign",
  "id",
  "increments",
  "integerIncrements",
  "tinyIncrements",
  "smallIncrements",
  "mediumIncrements",
  "bigIncrements",
  "char",
  "string",
  "tinyText",
  "text",
  "mediumText",
  "longText",
  "integer",
  "tinyInteger",
  "smallInteger",
  "mediumInteger",
  "bigInteger",
  "unsignedInteger",
  "unsignedTinyInteger",
  "unsignedSmallInteger",
  "unsignedMediumInteger",
  "unsignedBigInteger",
  "foreignId",
  "foreignIdFor",
  "float",
  "double",
  "decimal",
  "unsignedFloat",
  "unsignedDouble",
  "unsignedDecimal",
  "boolean",
  "enum",
  "set",
  "json",
  "jsonb",
  "date",
  "dateTime",
  "dateTimeTz",
  "time",
  "timeTz",
  "timestamp",
  "timestampTz",
  "timestamps",
  "nullableTimestamps",
  "timestampsTz",
  "softDeletes",
  "softDeletesTz",
  "year",
  "binary",
  "uuid",
  "foreignUuid",
  "ipAddress",
  "macAddress",
  "geometry",
  "point",
  "lineString",
  "polygon",
  "geometryCollection",
  "multiPoint",
  "multiLineString",
  "multiPolygon",
  "multiPolygonZ",
  "computed",
  "morphs",
  "nullableMorphs",
  "numericMorphs",
  "nullableNumericMorphs",
  "uuidMorphs",
  "nullableUuidMorphs",
  "rememberToken",
  "addColumn",
  "after",
  "removeColumn",
  "getTable",
  "getColumns",
  "getCommands",
  "getAddedColumns",
  "getChangedColumns",
  "hasAutoIncrementColumn",
  "autoIncrementingStartingValues",
  "macro",
  "mixin",
  "hasMacro",
  "flushMacros",
  "__callStatic",
  "__call"
]