Remove unused MorphToMany relationships from models and add CategoriesTableSeeder for category data population

This commit is contained in:
Mekan1206
2026-02-09 02:26:59 +05:00
parent 41d6ddc346
commit bac1579285
11 changed files with 185 additions and 9 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace Database\Seeders\New;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class PropertiesTableSeeder extends Seeder
{
public function run()
{
$datas = json_decode(File::get('database/data/properties.json'));
$table = 'attributes';
DB::table($table)->truncate();
foreach ($datas as $data) {
DB::table($table)->insertOrIgnore([
'id' => $data->id,
'slug' => $data->code,
'name' => str_replace('"tm"', '"tk"', $data->name),
'description' => $data->description,
'type' => 'text',
'created_at' => $data->created_at,
'updated_at' => $data->updated_at,
]);
}
DB::statement("
SELECT setval('{$table}_id_seq', (SELECT MAX(id) from {$table}))
");
}
}