cấu hình chạy lần đầu - chưa thực hiện test
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('danh_sach_giai_thuong', function (Blueprint $table) {
|
||||
$table->id('ma_giai_thuong');
|
||||
$table->string('noi_dung');
|
||||
$table->string('hinh_anh')->nullable();
|
||||
$table->integer('so_thu_tu')->default(0);
|
||||
$table->string('ma_so_nhan_giai')->nullable();
|
||||
$table->string('ten_nguoi_nhan_giai')->nullable();
|
||||
$table->string('phan_loai_khach')->nullable();
|
||||
$table->string('ma_so_nhan_giai_thuc_te')->nullable();
|
||||
$table->string('ten_nguoi_nhan_giai_thuc_te')->nullable();
|
||||
$table->tinyInteger('da_nhan_giai')->default(0);
|
||||
$table->integer('thoi_gian_cho')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('danh_sach_giai_thuong');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('danh_sach_nguoi_dung', function (Blueprint $table) {
|
||||
$table->id('id_nguoi_dung');
|
||||
$table->string('ma_nguoi_dung')->unique();
|
||||
$table->string('ten_nguoi_dung');
|
||||
$table->string('loai_nguoi_dung')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('danh_sach_nguoi_dung');
|
||||
}
|
||||
};
|
||||
41
database/seeders/DanhSachGiaiThuongSeeder.php
Normal file
41
database/seeders/DanhSachGiaiThuongSeeder.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DanhSachGiaiThuongSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$prizes = [
|
||||
['noi_dung' => 'Giải Nhất', 'so_thu_tu' => 1],
|
||||
['noi_dung' => 'Giải Nhì', 'so_thu_tu' => 2],
|
||||
['noi_dung' => 'Giải Ba', 'so_thu_tu' => 3],
|
||||
['noi_dung' => 'Giải Tư', 'so_thu_tu' => 4],
|
||||
['noi_dung' => 'Giải Năm', 'so_thu_tu' => 5],
|
||||
['noi_dung' => 'Giải Sáu', 'so_thu_tu' => 6],
|
||||
['noi_dung' => 'Giải Bảy', 'so_thu_tu' => 7],
|
||||
['noi_dung' => 'Giải Tám', 'so_thu_tu' => 8],
|
||||
['noi_dung' => 'Giải Chín', 'so_thu_tu' => 9],
|
||||
['noi_dung' => 'Giải Mười', 'so_thu_tu' => 10],
|
||||
];
|
||||
|
||||
foreach ($prizes as $prize) {
|
||||
DB::table('danh_sach_giai_thuong')->insert([
|
||||
'noi_dung' => $prize['noi_dung'],
|
||||
'so_thu_tu' => $prize['so_thu_tu'],
|
||||
'da_nhan_giai' => 0,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user