2020_06_09_114500_create_news_table.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateNewsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('news', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->integer('section_id')->unsigned()->nullable();
  17. $table->foreign('section_id')->references('id')->on('sections');
  18. $table->integer('region_1_id')->unsigned()->nullable();
  19. $table->foreign('region_1_id')->references('id')->on('sections');
  20. $table->integer('region_2_id')->unsigned()->nullable();
  21. $table->foreign('region_2_id')->references('id')->on('sections');
  22. $table->string('title');
  23. $table->string('title_region_1')->nullable();
  24. $table->string('title_region_2')->nullable();
  25. $table->string('text_short')->nullable();
  26. $table->text('text')->nullable();
  27. $table->string('image')->nullable();
  28. $table->boolean('online');
  29. $table->boolean('homepage');
  30. $table->datetime('date')->nullable();
  31. $table->timestamps();
  32. });
  33. }
  34. /**
  35. * Reverse the migrations.
  36. *
  37. * @return void
  38. */
  39. public function down()
  40. {
  41. Schema::dropIfExists('news');
  42. }
  43. }