public static function _schema_UserModel(Blueprint $table) { $table->string('email')->nullable()->label('邮箱'); $table->string('mobile')->nullable()->label('手机号码'); $table->string('username')->nullable()->label('姓名'); $table->string('nickname')->nullable()->label('昵称'); $table->enum('gender', ['未填' => '未填', '男' => '男', '女' => '女'])->default('未填')->label('性别'); $table->string('avatar')->nullable()->label('头像'); $table->date('birthday')->nullable()->label('生日'); return $table; }
public static function _schema_usermodel(\Illuminate\Database\Schema\Blueprint $table) { $table->string('username', 100); $table->string('nickname', 30)->unique(); $table->string('email', 100); $table->string('mobile', 20); $table->integer('exp')->default(0); $table->integer('points')->default(0); $table->date('birthdate')->nullable(); $table->enum('gender', ['男', '女', '保密'])->default('保密'); $table->string('password', 100); $table->string('remember_token', 100); $table->timestamp('last_login'); return $table; }
/** * Campo DATA. */ public function date($column) { $col = parent::date(strtolower($column)); $col->nullable(true); return $col; }
public function testAddingDate() { $blueprint = new Blueprint('users'); $blueprint->date('foo'); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table "users" add "foo" date not null', $statements[0]); }
/** * @param Blueprint $table * * @return \Illuminate\Support\Fluent */ public function setDatabaseFieldType(Blueprint $table) { return $table->date($this->getDBKey())->default($this->getDatabaseDefaultValue()); }