make(Illuminate\Contracts\Console\Kernel::class); $kernel->bootstrap(); $u = App\Models\User::find(11); $unitId = $u->units()->value('units.id'); $unitUser = App\Models\UnitUser::where('user_id', 11)->where('unit_id', $unitId)->first(); $userType = App\Models\UserType::find($unitUser->user_type_id); echo "Andreia Unit: {$unitId}\n"; echo "Andreia UserType ID: {$userType->id}\n"; echo "Andreia UserType Label: {$userType->label}\n"; echo "Andreia UserType System Key: {$userType->system_key}\n"; $permissions = App\Models\UserTypePermission::where('user_type_id', $userType->id)->get(); echo "Permissions count: " . $permissions->count() . "\n";