<?php

namespace Database\Seeders\Admin;

use Illuminate\Database\Seeder;
use App\Models\Permission\Permission;
use App\Helpers\CoreApp\Traits\PermissionTrait;

class PermissionSeeder extends Seeder
{
    use PermissionTrait;

    public function run()
    {
        foreach ($this->adminRolePermissions() ?? [] as $key => $groupData) {
            Permission::create(
                [
                    'attribute'  => $key,
                    'menu_order' => @$groupData['menu_order'],
                    'keywords'   => $groupData['permissions'],
                    'created_at' => now(),
                    'updated_at' => now()
                ]
            );
        }
    }
}
