Guest User

Untitled

a guest
Feb 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. /** Author: yourname :D **/
  3. use Illuminate\Support\Facades\Schema;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Database\Migrations\Migration;
  6.  
  7. class CreateAdminsTable extends Migration {
  8.  
  9. /**
  10. * Run the migrations.
  11. *
  12. * @return void
  13. */
  14. public function up() {
  15. Schema::create('admins', function (Blueprint $table) {
  16. $table->increments('id');
  17. $table->string('email')->unique();
  18. $table->timestamps();
  19. $table->foreign('email')
  20. ->references('email')->on('users')
  21. ->onDelete('cascade');
  22. });
  23. }
  24.  
  25. /**
  26. * Reverse the migrations.
  27. *
  28. * @return void
  29. */
  30. public function down() {
  31. Schema::dropIfExists('admins');
  32. }
  33.  
  34. }
Add Comment
Please, Sign In to add comment