6
0
Fork 0
jiqu-library-server/database/seeders/ShippingSeeder.php

34 lines
788 B
PHP

<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\{ShippingTemplate, ShippingRule, Zone};
use Illuminate\Support\Facades\DB;
class ShippingSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$template = ShippingTemplate::create([
'name' => '自提'
]);
$zons = Zone::where('type', Zone::TYPE_AREA)->pluck('id')->map(fn($v) => $v."");
DB::table('shipping_rules')->insert([
'template_id' => $template->id,
'type' => 1,
'info' => json_encode(["threshold" => "0"]),
'zones' => json_encode($zons),
'created_at' => now(),
'updated_at' => now()
]);
}
}