<?php

namespace Database\Seeders;

use App\Modules\Settings\Rbac\Repositories\PermissionRepository;
use Illuminate\Database\Seeder;

class RbacSeeder extends Seeder
{
    public function run(): void
    {
        $slugs = config('tenant-permissions.abilities', []);
        $labels = [];
        foreach ($slugs as $slug) {
            $key = 'permissions.abilities.'.$slug;
            $labels[$slug] = __($key) !== $key
                ? __($key)
                : str_replace('.', ' ', (string) $slug);
        }
        app(PermissionRepository::class)->syncFromConfigList($labels);
    }
}
