<?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;}

$rows = Illuminate\Support\Facades\DB::table('model_has_roles')->where('model_id',$u->id)->get();
echo 'model_has_roles_rows=' . $rows->count() . PHP_EOL;
foreach($rows as $r){
  $name = Spatie\Permission\Models\Role::where('id',$r->role_id)->value('name');
  echo 'role_id=' . $r->role_id . ', role_name=' . $name . ', model_type=' . $r->model_type . PHP_EOL;
}
