| 1234567891011121314151617181920212223242526272829 |
- <?php
- require __DIR__.'/vendor/autoload.php';
- $app = require_once __DIR__.'/bootstrap/app.php';
- $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
- $kernel->bootstrap();
- try {
- $count = App\Models\UserType::count();
- echo "DB is UP! \n";
-
- // Find Andreia
- $andreia = App\Models\User::find(11);
- if ($andreia) {
- $unitId = $andreia->units()->value('units.id');
- echo "Andreia Unit ID: " . $unitId . "\n";
-
- $roles = App\Models\UserType::where('unit_id', $unitId)->get();
- echo "\nPerfis da unidade da Andreia:\n";
- foreach($roles as $role) {
- $permCount = App\Models\UserTypePermission::where('user_type_id', $role->id)->count();
- echo "- {$role->label} (slug: {$role->slug}, is_system: {$role->is_system}) | Permissões: {$permCount}\n";
- }
- } else {
- echo "Andreia nao encontrada.\n";
- }
- } catch (\Exception $e) {
- echo "DB_IS_DOWN: " . $e->getMessage() . "\n";
- }
|