1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-12-25 03:15:59 +00:00

docs(laravel): add collection column modifiers

This commit is contained in:
Julien Le Coupanec 2020-03-23 16:05:32 +01:00
parent 2269417161
commit 45bf363110

View File

@ -327,6 +327,26 @@ $table->unsignedTinyInteger('votes'); // UNSIGNED TINYINT equivalen
$table->uuid('id'); // UUID equivalent column. $table->uuid('id'); // UUID equivalent column.
$table->year('birth_year'); // YEAR equivalent column. $table->year('birth_year'); // YEAR equivalent column.
/********************************************************************************************
* COLLECTION COLUMN MODIFIERS
* https://laravel.com/docs/5.7/migrations#column-modifiers
********************************************************************************************/
$table->someType()->after('column'); // Place the column "after" another column (MySQL)
$table->someType()->autoIncrement(); // Set INTEGER columns as auto-increment (primary key)
$table->someType()->charset('utf8'); // Specify a character set for the column (MySQL)
$table->someType()->collation('utf8_unicode_ci'); // Specify a collation for the column (MySQL/SQL Server)
$table->someType()->comment('my comment'); // Add a comment to a column (MySQL/PostgreSQL)
$table->someType()->default($value); // Specify a "default" value for the column
$table->someType()->first(); // Place the column "first" in the table (MySQL)
$table->someType()->nullable($value = true); // Allows (by default) NULL values to be inserted into the column
$table->someType()->storedAs($expression); // Create a stored generated column (MySQL)
$table->someType()->unsigned(); // Set INTEGER columns as UNSIGNED (MySQL)
$table->someType()->useCurrent(); // Set TIMESTAMP columns to use CURRENT_TIMESTAMP as default value
$table->someType()->virtualAs($expression); // Create a virtual generated column (MySQL)
$table->someType()->generatedAs($expression); // Create an identity column with specified sequence options (PostgreSQL)
$table->someType()->always(); // Defines the precedence of sequence values over input for an identity column (PostgreSQL)
/******************************************************************************************** /********************************************************************************************
* COLLECTION ELOQUENT METHODS * COLLECTION ELOQUENT METHODS
* https://laravel.com/docs/5.7/collections * https://laravel.com/docs/5.7/collections