-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] Base database structure seeders
- Loading branch information
1 parent
546cd8a
commit b255dca
Showing
5 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use App\Models\Board; | ||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class BoardSeeder extends Seeder | ||
{ | ||
use WithoutModelEvents; | ||
|
||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
Board::create([ | ||
'uuid' => 'FCDR567NAK7U', | ||
'name' => 'Main classroom', | ||
'ip' => '192.168.2.56', | ||
'last_seen' => now(), | ||
]); | ||
Board::create([ | ||
'uuid' => 'FXXGFSK8HG35', | ||
'name' => 'Telecomunications room', | ||
'ip' => '192.168.2.67', | ||
'last_seen' => now(), | ||
]); | ||
Board::create([ | ||
'uuid' => 'FCDR567NAK7U', | ||
'name' => 'Main classroom', | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use App\Models\Measurement; | ||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class MeasurementSeeder extends Seeder | ||
{ | ||
use WithoutModelEvents; | ||
|
||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
$temp = 20; | ||
$gradient = 2; | ||
//Make ramp to soak | ||
for ($i = 1; $i <= 40; $i++) { | ||
Measurement::create([ | ||
'session_id' => 1, | ||
'temperature' => $temp, | ||
'sequence' => $i, | ||
]); | ||
$temp += $gradient; | ||
} | ||
//Now we make soak time | ||
for ($i = 41; $i <= 140; $i++) { | ||
Measurement::create([ | ||
'session_id' => 1, | ||
'temperature' => $temp, | ||
'sequence' => $i, | ||
]); | ||
} | ||
$gradient = 5; //ramp up gradient to peak | ||
for ($i = 141; $i < 158; $i++) { | ||
Measurement::create([ | ||
'session_id' => 1, | ||
'temperature' => $temp, | ||
'sequence' => $i, | ||
]); | ||
$temp += $gradient; | ||
} | ||
//Cool down ramp | ||
$gradient = -6; | ||
for ($i = 158; $i <= 185; $i++) { | ||
Measurement::create([ | ||
'session_id' => 1, | ||
'temperature' => $temp, | ||
'sequence' => $i, | ||
]); | ||
$temp += $gradient; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use App\Models\Profile; | ||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class ProfileSeeder extends Seeder | ||
{ | ||
use WithoutModelEvents; | ||
|
||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
Profile::create([ | ||
'name' => 'Eutetic', | ||
'soak_time' => 70, | ||
'soak_temperature' => 100, | ||
'reflow_gradient' => 2, | ||
'reflow_peak_temp' => 183, | ||
'reflow_max_time' => 120, | ||
'ramp_up_gradient' => 5, | ||
'cooldown_gradient' => -6, | ||
]); | ||
Profile::create([ | ||
'name' => 'Lead free', | ||
'soak_time' => 90, | ||
'soak_temperature' => 120, | ||
'reflow_gradient' => 4, | ||
'reflow_peak_temp' => 210, | ||
'reflow_max_time' => 150, | ||
'ramp_up_gradient' => 6, | ||
'cooldown_gradient' => -5, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use App\Models\Session; | ||
use Carbon\Carbon; | ||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class SessionSeeder extends Seeder | ||
{ | ||
use WithoutModelEvents; | ||
|
||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
Session::create([ | ||
'board_id' => 1, | ||
'date' => Carbon::now()->subDays(5), | ||
'soak_time' => 70, | ||
'soak_temperature' => 100, | ||
'reflow_gradient' => 2, | ||
'reflow_peak_temp' => 183, | ||
'reflow_max_time' => 120, | ||
'ramp_up_gradient' => 5, | ||
'cooldown_gradient' => -6, | ||
]); | ||
Session::create([ | ||
'board_id' => 1, | ||
'date' => Carbon::now()->subDays(2), | ||
'soak_time' => 90, | ||
'soak_temperature' => 120, | ||
'reflow_gradient' => 4, | ||
'reflow_peak_temp' => 210, | ||
'reflow_max_time' => 150, | ||
'ramp_up_gradient' => 6, | ||
'cooldown_gradient' => -5, | ||
]); | ||
} | ||
} |