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

Time:04-07

Schema::create('flights', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('airline'); $table->timestamps(); });

CodePudding user response:

Well, $table is an instance of \Illuminate\Database\Schema\Blueprint which can be found here : vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php

All available methods can be found in that class.

Just for proof, here is the class : Log::info(get_class($table);

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

Here is the result of available methods : Log::info(json_encode(get_class_methods($table)));

Result :

[
  "__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"
]
  • Related