HEX
Server: nginx/1.28.3
System: Linux lightweb-s1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User: drdrivek-71 (1047)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home/eslinced-103/brise-edu.or.kr/database/seeders/TenantDatabaseSeeder.php
<?php

namespace Database\Seeders;

use App\Models\Post;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Storage;

class TenantDatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        if(config('amuz.use_tenant_preset',false) === true) {
            if(Post::all()->count() < 1){
                Post::create([
                    'user_id' => 1,
                    'title' => 'Welcome',
                    'body' => "Try creating another blog post here, then register as another tenant on your central domain. You'll see the data separation in practice.",
                ]);

                Post::create([
                    'user_id' => 1,
                    'title' => 'README!',
                    'body' => "Be sure to check the README.md file. It explains how things are structured, why they're structured that way and how to make the most out of this boilerplate.",
                ]);

                Post::create([
                    'user_id' => 1,
                    'title' => '🚀 Ship fast',
                    'body' => "As always, don't forget to ship fast 😎. We hope this boilerplate saves you a lot of development time and lets you get to production much faster.",
                ]);
            }
        }

        $packages = $this->getAmuzPackages();
        foreach($packages as $package){
            $path = base_path(sprintf('AmuzPackages/%s/Database/Seeders/Tenant/TenantDatabaseSeeder.php',$package));
            if(file_exists($path)){
                $class = new (sprintf('AmuzPackages\\%s\\Database\\Seeders\\Tenant\\TenantDatabaseSeeder',$package))();
                $class->run();
            }
        }
    }


    private function getAmuzPackages(): array
    {
        return Storage::disk('package')->directories();
    }
}