<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Spatie\Permission\Models\Permission;

class ListPermissions extends Command
{
    protected $signature = 'admin:list-permissions';
    protected $description = 'List all permissions in the database';

    public function handle()
    {
        $permissions = Permission::all();
        
        $this->info("Total permissions: {$permissions->count()}");
        $this->line("");
        
        $permissions->each(function($permission) {
            $this->line("• {$permission->name}");
        });
        
        return Command::SUCCESS;
    }
}