Siopas Inventory PETI for ISTW Website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 lines
1.2 KiB

<?php
namespace Database\Seeders;
use App\Models\Type_peti;
use Illuminate\Database\Seeder;
class TipePetiSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Type_peti::create([
'type' => 'Kecil',
'size_peti' => '2 X 2 X 2',
'description' => 'Peti dengan ukuran kecil',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
Type_peti::create([
'type' => 'Standar',
'size_peti' => '3 X 3 X 3',
'description' => 'Peti dengan ukuran standar',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
for ($i = 3; $i <= 5; $i++) {
Type_peti::create([
'type' => 'Type ' . $i,
'size_peti' => $this->generateSize(),
'description' => 'Description for Type ' . $i,
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
}
}
/**
* Generate a random size for the peti.
*/
private function generateSize(): string
{
return rand(1, 10) . ' X ' . rand(1, 10) . ' X ' . rand(1, 10);
}
}