EscolaLMS/Categories

View on GitHub
database/seeders/CategoriesSeeder.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace EscolaLms\Categories\Database\Seeders;

use Illuminate\Database\Seeder;
use EscolaLms\Categories\Models\Category;

class CategoriesSeeder extends Seeder
{
    public function run()
    {
        $categories = Category::factory(10)->create();
        foreach ($categories as $category) {
            $category->children()->save(Category::factory()->create());
        }
    }
}