1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-12-23 18:48:54 +00:00

docs(laravel): Add collection column types

This commit is contained in:
Julien Le Coupanec 2020-03-23 16:01:29 +01:00
parent 296c01b279
commit 2269417161

View File

@ -1,11 +1,11 @@
<?php
/********************************************************************************************
* 1. CLI AVAILABLE COMMANDS FOR ARTISAN
* CLI AVAILABLE COMMANDS FOR ARTISAN
* https://laravel.com/docs/5.8/artisan
********************************************************************************************/
// 1.1. MAIN.
// MAIN.
php artisan clear-compiled // Remove the compiled class file
php artisan down // Put the application into maintenance mode
@ -21,38 +21,38 @@ php artisan serve // Serve the application on the PHP development
php artisan tinker // Interact with your application
php artisan up // Bring the application out of maintenance mode
// 1.2. APP.
// APP.
php artisan app:name // Set the application namespace
// 1.3. AUTH
// AUTH
php artisan auth:clear-resets // Flush expired password reset tokens
// 1.4. CACHE
// CACHE
php artisan cache:clear // Flush the application cache
php artisan cache:forget // Remove an item from the cache
php artisan cache:table // Create a migration for the cache database table
// 1.5. CONFIG
// CONFIG
php artisan config:cache // Create a cache file for faster configuration loading
php artisan config:clear // Remove the configuration cache file
// 1.6. DB
// DB
php artisan db:seed // Seed the database with records
// 1.7. EVENT
// EVENT
php artisan event:generate // Generate the missing events and listeners based on registration
// 1.8. KEY
// KEY
php artisan key:generate // Set the application key
// 1.9. MAKE
// MAKE
php artisan make:auth // Scaffold basic login and registration views and routes
php artisan make:channel // Create a new channel class
@ -77,7 +77,7 @@ php artisan make:rule // Create a new validation rule
php artisan make:seeder // Create a new seeder class
php artisan make:test // Create a new test class
// 1.10. MIGRATE
// MIGRATE
php artisan migrate:fresh // Drop all tables and re-run all migrations
php artisan migrate:install // Create the migration repository
@ -86,19 +86,19 @@ php artisan migrate:reset // Rollback all database migrations
php artisan migrate:rollback // Rollback the last database migration
php artisan migrate:status // Show the status of each migration
// 1.11. NOTIFICATIONS
// NOTIFICATIONS
php artisan notifications:table // Create a migration for the notifications table
// 1.12. OPTIMIZE
// OPTIMIZE
php artisan optimize:clear // Remove the cached bootstrap files
// 1.13. PACKAGE
// PACKAGE
php artisan package:discover // Rebuild the cached package manifest
// 1.14. QUEUE
// QUEUE
php artisan queue:failed // List all of the failed queue jobs
php artisan queue:failed-table // Create a migration for the failed queue jobs database table
@ -110,35 +110,35 @@ php artisan queue:retry // Retry a failed queue job
php artisan queue:table // Create a migration for the queue jobs database table
php artisan queue:work // Start processing jobs on the queue as a daemon
// 1.15. ROUTE
// ROUTE
php artisan route:cache // Create a route cache file for faster route registration
php artisan route:clear // Remove the route cache file
php artisan route:list // List all registered routes
// 1.16. SCHEDULE
// SCHEDULE
php artisan schedule:run // Run the scheduled commands
// 1.17. SESSION
// SESSION
php artisan session:table // Create a migration for the session database table
// 1.18. STORAGE
// STORAGE
php artisan storage:link // Create a symbolic link from "public/storage" to "storage/app/public"
// 1.19. VENDOR
// VENDOR
php artisan vendor:publish // Publish any publishable assets from vendor packages
// 1.20. VIEW
// VIEW
php artisan view:cache // Compile all of the application's Blade templates
php artisan view:clear // Clear all compiled view files
/********************************************************************************************
* 2. REQUEST
* REQUEST
* https://laravel.com/api/5.8/Illuminate/Http/Request.html
* https://laravel.com/docs/5.8/requests
********************************************************************************************/
@ -146,7 +146,7 @@ php artisan view:clear // Clear all compiled view files
/********************************************************************************************
* 3. RESPONSE
* RESPONSE
* https://laravel.com/api/5.8/Illuminate/Http/Response.html
* https://laravel.com/docs/5.8/responses
********************************************************************************************/
@ -154,41 +154,41 @@ php artisan view:clear // Clear all compiled view files
/********************************************************************************************
* 4. ROUTING
* ROUTING
* https://laravel.com/docs/5.8/routing
********************************************************************************************/
/********************************************************************************************
* 5. MIDDLEWARE
* MIDDLEWARE
* https://laravel.com/docs/5.8/middleware
********************************************************************************************/
/********************************************************************************************
* 6. CONTROLLERS
* CONTROLLERS
* https://laravel.com/docs/5.8/controllers
********************************************************************************************/
/********************************************************************************************
* 7. SESSION
* SESSION
* https://laravel.com/docs/5.8/session
********************************************************************************************/
/********************************************************************************************
* 8. URL GENERATION
* URL GENERATION
* https://laravel.com/docs/5.8/urls
********************************************************************************************/
/********************************************************************************************
* 9. VALIDATION
* VALIDATION
* https://laravel.com/docs/5.8/validation
********************************************************************************************/
@ -258,20 +258,77 @@ url // The field under validation must be a v
uuid // The field under validation must be a valid RFC 4122 (version 1, 3, 4, or 5) universally unique identifier (UUID).
/********************************************************************************************
* 10. ERROR HANDLING
* ERROR HANDLING
* https://laravel.com/docs/5.8/errors
********************************************************************************************/
/********************************************************************************************
* 11. LOGGING
* https://laravel.com/docs/5.8/logging
* COLLECTION COLUMN TYPES
* https://laravel.com/docs/5.8/migrations#generating-migrations
********************************************************************************************/
$table->bigIncrements('id'); // Auto-incrementing UNSIGNED BIGINT (primary key) equivalent column.
$table->bigInteger('votes'); // BIGINT equivalent column.
$table->binary('data'); // BLOB equivalent column.
$table->boolean('confirmed'); // BOOLEAN equivalent column.
$table->char('name', 100); // CHAR equivalent column with an optional length.
$table->date('created_at'); // DATE equivalent column.
$table->dateTime('created_at'); // DATETIME equivalent column.
$table->dateTimeTz('created_at'); // DATETIME (with timezone) equivalent column.
$table->decimal('amount', 8, 2); // DECIMAL equivalent column with a precision (total digits) and scale (decimal digits).
$table->double('amount', 8, 2); // DOUBLE equivalent column with a precision (total digits) and scale (decimal digits).
$table->enum('level', ['easy', 'hard']); // ENUM equivalent column.
$table->float('amount', 8, 2); // FLOAT equivalent column with a precision (total digits) and scale (decimal digits).
$table->geometry('positions'); // GEOMETRY equivalent column.
$table->geometryCollection('positions'); // GEOMETRYCOLLECTION equivalent column.
$table->increments('id'); // Auto-incrementing UNSIGNED INTEGER (primary key) equivalent column.
$table->integer('votes'); // INTEGER equivalent column.
$table->ipAddress('visitor'); // IP address equivalent column.
$table->json('options'); // JSON equivalent column.
$table->jsonb('options'); // JSONB equivalent column.
$table->lineString('positions'); // LINESTRING equivalent column.
$table->longText('description'); // LONGTEXT equivalent column.
$table->macAddress('device'); // MAC address equivalent column.
$table->mediumIncrements('id'); // Auto-incrementing UNSIGNED MEDIUMINT (primary key) equivalent column.
$table->mediumInteger('votes'); // MEDIUMINT equivalent column.
$table->mediumText('description'); // MEDIUMTEXT equivalent column.
$table->morphs('taggable'); // Adds taggable_id UNSIGNED BIGINT and taggable_type VARCHAR equivalent columns.
$table->uuidMorphs('taggable'); // Adds taggable_id CHAR(36) and taggable_type VARCHAR(255) UUID equivalent columns.
$table->multiLineString('positions'); // MULTILINESTRING equivalent column.
$table->multiPoint('positions'); // MULTIPOINT equivalent column.
$table->multiPolygon('positions'); // MULTIPOLYGON equivalent column.
$table->nullableMorphs('taggable'); // Adds nullable versions of morphs() columns.
$table->nullableUuidMorphs('taggable'); // Adds nullable versions of uuidMorphs() columns.
$table->nullableTimestamps(); // Alias of timestamps() method.
$table->point('position'); // POINT equivalent column.
$table->polygon('positions'); // POLYGON equivalent column.
$table->rememberToken(); // Adds a nullable remember_token VARCHAR(100) equivalent column.
$table->set('flavors', ['strawberry', 'vanilla']); // SET equivalent column.
$table->smallIncrements('id'); // Auto-incrementing UNSIGNED SMALLINT (primary key) equivalent column.
$table->smallInteger('votes'); // SMALLINT equivalent column.
$table->softDeletes(); // Adds a nullable deleted_at TIMESTAMP equivalent column for soft deletes.
$table->softDeletesTz(); // Adds a nullable deleted_at TIMESTAMP (with timezone) equivalent column for soft deletes.
$table->string('name', 100); // VARCHAR equivalent column with a optional length.
$table->text('description'); // TEXT equivalent column.
$table->time('sunrise'); // TIME equivalent column.
$table->timeTz('sunrise'); // TIME (with timezone) equivalent column.
$table->timestamp('added_on'); // TIMESTAMP equivalent column.
$table->timestampTz('added_on'); // TIMESTAMP (with timezone) equivalent column.
$table->timestamps(); // Adds nullable created_at and updated_at TIMESTAMP equivalent columns.
$table->timestampsTz(); // Adds nullable created_at and updated_at TIMESTAMP (with timezone) equivalent columns.
$table->tinyIncrements('id'); // Auto-incrementing UNSIGNED TINYINT (primary key) equivalent column.
$table->tinyInteger('votes'); // TINYINT equivalent column.
$table->unsignedBigInteger('votes'); // UNSIGNED BIGINT equivalent column.
$table->unsignedDecimal('amount', 8, 2); // UNSIGNED DECIMAL equivalent column with a precision (total digits) and scale (decimal digits).
$table->unsignedInteger('votes'); // UNSIGNED INTEGER equivalent column.
$table->unsignedMediumInteger('votes'); // UNSIGNED MEDIUMINT equivalent column.
$table->unsignedSmallInteger('votes'); // UNSIGNED SMALLINT equivalent column.
$table->unsignedTinyInteger('votes'); // UNSIGNED TINYINT equivalent column.
$table->uuid('id'); // UUID equivalent column.
$table->year('birth_year'); // YEAR equivalent column.
/********************************************************************************************
* 12. COLLECTIONS
* COLLECTION ELOQUENT METHODS
* https://laravel.com/docs/5.7/collections
********************************************************************************************/
@ -384,7 +441,7 @@ wrap
zip
/********************************************************************************************
* 13. HTTP TESTS
* HTTP TESTS
* https://laravel.com/docs/5.7/http-tests
********************************************************************************************/
@ -441,7 +498,7 @@ $this->assertCredentials(array $credentials, $guard = null); // $this->a
$this->assertInvalidCredentials(array $credentials, $guard = null); // Assert that the given credentials are invalid.
/********************************************************************************************
* 14. LARAVEL VALET COMMANDS
* LARAVEL VALET COMMANDS
* https://laravel.com/docs/6.0/valet
********************************************************************************************/