This commit is contained in:
2026-02-03 15:31:29 +05:00
commit 326c677e8d
2800 changed files with 1489388 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace Database\Seeders;
use Exception;
use File;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class PostBranchTableSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$datas = json_decode(File::get('database/data/post_branches.json'));
$table = 'post_branches';
DB::table($table)->truncate();
try {
foreach ($datas as $data) {
DB::table($table)->insert([
'id' => $data->id,
'province_id' => $data->province_id,
'name' => $data->name,
'address' => $data->address,
'description' => $data->description,
'created_at' => $data->created_at,
'updated_at' => $data->updated_at,
]);
}
} catch (Exception $e) {
info(['Ignore error', $e->getMessage()]);
}
DB::statement("
SELECT setval('{$table}_id_seq', (SELECT MAX(id) from {$table}))
");
}
}