Files
futurewalker/database/seeders/CategorySeeder.php

110 lines
4.1 KiB
PHP

<?php
namespace Database\Seeders;
use App\Models\Category;
use Illuminate\Database\Seeder;
class CategorySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$categories = [
['name' => 'Automotive', 'short_name' => 'Automotive'],
[
'name' => 'Business',
'short_name' => 'Business',
'children' => [
['name' => 'Trading', 'short_name' => 'Trading'],
['name' => 'Information Technology', 'short_name' => 'IT'],
['name' => 'Marketing', 'short_name' => 'Marketing'],
['name' => 'Office', 'short_name' => 'Office'],
['name' => 'Telecommunications', 'short_name' => 'Telecom'],
],
],
['name' => 'Food & Drink', 'short_name' => 'Food'],
[
'name' => 'Hobbies & Gifts',
'short_name' => 'Hobbies',
'children' => [
['name' => 'Collectibles', 'short_name' => 'Collectibles'],
['name' => 'Pets', 'short_name' => 'Pets'],
['name' => 'Photography', 'short_name' => 'Photography'],
['name' => 'Hunting & Fishing', 'short_name' => 'Hunting'],
],
],
['name' => 'Law', 'short_name' => 'Law'],
['name' => 'Politics', 'short_name' => 'Politics'],
[
'name' => 'Shopping',
'short_name' => 'Shopping',
'children' => [
['name' => 'Home & Garden', 'short_name' => 'Home'],
['name' => 'Fashion & Clothing', 'short_name' => 'Fashion'],
],
],
['name' => 'Real Estate', 'short_name' => 'Real Estate'],
[
'name' => 'Society',
'short_name' => 'Society',
'children' => [
['name' => 'Family', 'short_name' => 'Family'],
['name' => 'Wedding', 'short_name' => 'Wedding'],
['name' => 'Immigration', 'short_name' => 'Immigration'],
[
'name' => 'Education',
'short_name' => 'Education',
'children' => [
['name' => 'Languages', 'short_name' => 'Languages'],
],
],
],
],
[
'name' => 'Wellness',
'short_name' => 'Wellness',
'children' => [
['name' => 'Health', 'short_name' => 'Health'],
['name' => 'Beauty', 'short_name' => 'Beauty'],
['name' => 'Psychology', 'short_name' => 'Psychology'],
['name' => 'Religion & Spirituality', 'short_name' => 'Religion'],
],
],
[
'name' => 'Tips & Tricks',
'short_name' => 'Tips',
'children' => [
['name' => 'How to', 'short_name' => 'How to'],
],
],
[
'name' => 'Travel',
'short_name' => 'Travel',
'children' => [
['name' => 'Holiday', 'short_name' => 'Holiday'],
['name' => 'World Festivals', 'short_name' => 'Festivals'],
['name' => 'Outdoors', 'short_name' => 'Outdoors'],
],
],
[
'name' => 'Technology',
'short_name' => 'Tech',
'children' => [
['name' => 'Computer', 'short_name' => 'Computer'],
['name' => 'Phones', 'short_name' => 'Phones'],
['name' => 'Gadgets', 'short_name' => 'Gadgets'],
['name' => 'Social Networks', 'short_name' => 'Social Networks'],
],
],
];
foreach ($categories as $category) {
$node = Category::create($category);
}
}
}