migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Modules\Restaurant\Models\Unit;
|
||||
|
||||
class UnitSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$restaurantId = 1; // fixed restaurant_id
|
||||
|
||||
// === Weight Units ===
|
||||
$gram = Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Gram',
|
||||
'short_name' => 'g',
|
||||
'type' => 'weight',
|
||||
'is_default' => 1,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Kilogram',
|
||||
'short_name' => 'kg',
|
||||
'type' => 'weight',
|
||||
'base_unit_id' => $gram->id,
|
||||
'operator' => '*',
|
||||
'operator_value' => 1000,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Milligram',
|
||||
'short_name' => 'mg',
|
||||
'type' => 'weight',
|
||||
'base_unit_id' => $gram->id,
|
||||
'operator' => '/',
|
||||
'operator_value' => 1000,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Pound',
|
||||
'short_name' => 'lb',
|
||||
'type' => 'weight',
|
||||
'base_unit_id' => $gram->id,
|
||||
'operator' => '*',
|
||||
'operator_value' => 453.592,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Ounce',
|
||||
'short_name' => 'oz',
|
||||
'type' => 'weight',
|
||||
'base_unit_id' => $gram->id,
|
||||
'operator' => '*',
|
||||
'operator_value' => 28.3495,
|
||||
]);
|
||||
|
||||
// === Volume Units ===
|
||||
$ml = Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Milliliter',
|
||||
'short_name' => 'ml',
|
||||
'type' => 'volume',
|
||||
'is_default' => 1,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Liter',
|
||||
'short_name' => 'l',
|
||||
'type' => 'volume',
|
||||
'base_unit_id' => $ml->id,
|
||||
'operator' => '*',
|
||||
'operator_value' => 1000,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Teaspoon',
|
||||
'short_name' => 'tsp',
|
||||
'type' => 'volume',
|
||||
'base_unit_id' => $ml->id,
|
||||
'operator' => '*',
|
||||
'operator_value' => 5,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Tablespoon',
|
||||
'short_name' => 'tbsp',
|
||||
'type' => 'volume',
|
||||
'base_unit_id' => $ml->id,
|
||||
'operator' => '*',
|
||||
'operator_value' => 15,
|
||||
]);
|
||||
|
||||
// === Count Units ===
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Piece',
|
||||
'short_name' => 'pcs',
|
||||
'type' => 'count',
|
||||
'is_default' => 1,
|
||||
]);
|
||||
|
||||
// === Length Units ===
|
||||
$meter = Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Meter',
|
||||
'short_name' => 'm',
|
||||
'type' => 'length',
|
||||
'is_default' => 1,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Centimeter',
|
||||
'short_name' => 'cm',
|
||||
'type' => 'length',
|
||||
'base_unit_id' => $meter->id,
|
||||
'operator' => '/',
|
||||
'operator_value' => 100,
|
||||
]);
|
||||
|
||||
Unit::create([
|
||||
'restaurant_id' => $restaurantId,
|
||||
'name' => 'Millimeter',
|
||||
'short_name' => 'mm',
|
||||
'type' => 'length',
|
||||
'base_unit_id' => $meter->id,
|
||||
'operator' => '/',
|
||||
'operator_value' => 1000,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user