2020_04_23_135008_create_settings_table.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateSettingsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('settings', function (Blueprint $table) {
  15. $table->id();
  16. $table->string('key');
  17. $table->string('value');
  18. $table->timestamps();
  19. });
  20. DB::table('settings')->insert(
  21. [[
  22. 'key' => 'lockdown',
  23. 'value' => 'no',
  24. "created_at" => \Carbon\Carbon::now(), # new \Datetime()
  25. "updated_at" => \Carbon\Carbon::now(), # new \Datetime()
  26. ], [
  27. 'key' => 'lockdown_msg',
  28. 'value' => 'Nothing is here',
  29. "created_at" => \Carbon\Carbon::now(), # new \Datetime()
  30. "updated_at" => \Carbon\Carbon::now(), # new \Datetime()
  31. ], [
  32. 'key' => 'srv_email',
  33. 'value' => 'fake@admin.net',
  34. "created_at" => \Carbon\Carbon::now(), # new \Datetime()
  35. "updated_at" => \Carbon\Carbon::now(), # new \Datetime()
  36. ]]
  37. );
  38. }
  39. /**
  40. * Reverse the migrations.
  41. *
  42. * @return void
  43. */
  44. public function down()
  45. {
  46. Schema::dropIfExists('settings');
  47. }
  48. }