<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();

$u = App\Models\User::where('email', 'member@example.com')->first();
if (! $u) { echo "member not found\n"; return; }

echo 'hasRole(super admin)=' . ($u->hasRole('super admin') ? 'yes' : 'no') . PHP_EOL;
try {
    echo 'hasPermissionTo(view categories)=' . ($u->hasPermissionTo('view categories') ? 'yes' : 'no') . PHP_EOL;
} catch (Throwable $e) {
    echo 'hasPermissionTo exception=' . $e->getMessage() . PHP_EOL;
}

echo 'can(view categories)=' . ($u->can('view categories') ? 'yes' : 'no') . PHP_EOL;
