Skip to content

Commit 963a59b

Browse files
committed
add specifications table & seeder
1 parent cb31b71 commit 963a59b

4 files changed

+115
-1
lines changed

app/Specification.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class Specification extends Model
8+
{
9+
//
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateSpecificationsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('specifications', function (Blueprint $table) {
17+
$table->bigIncrements('id');
18+
$table->string('model');
19+
$table->string('ver');
20+
$table->tinyInteger('num');
21+
$table->string('manufacturer');
22+
$table->string('vender_id');
23+
$table->integer('year');
24+
$table->tinyInteger('week');
25+
$table->timestamps();
26+
});
27+
}
28+
29+
/**
30+
* Reverse the migrations.
31+
*
32+
* @return void
33+
*/
34+
public function down()
35+
{
36+
Schema::dropIfExists('specifications');
37+
}
38+
}

database/seeds/DatabaseSeeder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder
1111
*/
1212
public function run()
1313
{
14-
// $this->call(UsersTableSeeder::class);
14+
$this->call(SpecificationsTableSeeder::class);
1515
}
1616
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
use App\Specification;
4+
use Illuminate\Database\Seeder;
5+
6+
class SpecificationsTableSeeder extends Seeder
7+
{
8+
/**
9+
* Run the database seeds.
10+
*
11+
* @return void
12+
*/
13+
public function run()
14+
{
15+
Specification::create([
16+
'model' => 'OMEN X 65',
17+
'ver' => '1.3',
18+
'num' => '2',
19+
'manufacturer' => 'HPN',
20+
'vender_id' => '3612',
21+
'year' => '2018',
22+
'week' => '51',
23+
]);
24+
25+
Specification::create([
26+
'model' => 'OMEN X 65',
27+
'ver' => '1.3',
28+
'num' => '2',
29+
'manufacturer' => 'HPN',
30+
'vender_id' => '3613',
31+
'year' => '2018',
32+
'week' => '51',
33+
]);
34+
35+
Specification::create([
36+
'model' => 'OMEN X 65 SB',
37+
'ver' => '1.3',
38+
'num' => '2',
39+
'manufacturer' => 'HPN',
40+
'vender_id' => '3612',
41+
'year' => '2019',
42+
'week' => '7',
43+
]);
44+
45+
Specification::create([
46+
'model' => 'OMEN X 65 SB',
47+
'ver' => '1.3',
48+
'num' => '2',
49+
'manufacturer' => 'HPN',
50+
'vender_id' => '3600',
51+
'year' => '2019',
52+
'week' => '7',
53+
]);
54+
55+
Specification::create([
56+
'model' => 'OMEN X 65 SB',
57+
'ver' => '1.3',
58+
'num' => '2',
59+
'manufacturer' => 'HPN',
60+
'vender_id' => '3613',
61+
'year' => '2019',
62+
'week' => '7',
63+
]);
64+
}
65+
}
66+

0 commit comments

Comments
 (0)