azishapidin

Add API Token Migration

Jun 9th, 2017
4,446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2.  
  3. use Illuminate\Support\Facades\Schema;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Database\Migrations\Migration;
  6.  
  7. class AddApiTokenUsers extends Migration
  8. {
  9.     /**
  10.      * Run the migrations.
  11.      *
  12.      * @return void
  13.      */
  14.     public function up()
  15.     {
  16.         Schema::table('users', function (Blueprint $table) {
  17.             $table->string('api_token', 100)->unique()->after('remember_token');
  18.         });
  19.     }
  20.     /**
  21.      * Reverse the migrations.
  22.      *
  23.      * @return void
  24.      */
  25.     public function down()
  26.     {
  27.         Schema::table('users', function (Blueprint $table) {
  28.             $table->dropColumn('api_token');
  29.         });
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment