| 123456789101112131415161718 |
- <?php
- require __DIR__.'/vendor/autoload.php';
- $app = require_once __DIR__.'/bootstrap/app.php';
- $kernel = $app->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";
|