-
반응형SMALL
@ Enum/EventType.php
<?php /** * Created by PhpStorm. * User: master * Date: 2019-11-24 * Time: 오후 6:03 */ namespace App\Enum; final class EventType { const MATCH = "match"; // 정답 일치 const INCLUDE = "include"; // 키워드 포함 public static function getValues() { return [self::MATCH, self::INCLUDE]; } }
@ create_example_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use App\Enum\EventState; use App\Enum\EventType; class CreateEventsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('events', function (Blueprint $table) { $table->bigIncrements('id'); $table->enum("type", [EventType::getValues()])->default(EventType::MATCH); // 정답매치 $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('events'); } }
LIST'Laravel' 카테고리의 다른 글
Object array 유효성 검사하는법 (0) 2020.07.19 Job(Queue) (0) 2020.06.14 엑셀(Excel) 다루기 (0) 2020.04.27 이미지 다루기 with 미디어 라이브러리(Media Library) + S3 (0) 2020.04.21 API Resource, Collection (0) 2020.03.27