argument('role'); $role = Role::where('name', $roleName)->first(); if (!$role) { $this->error("Role '{$roleName}' not found!"); return 1; } $permissions = Permission::all(); $this->info("Found {$permissions->count()} permissions"); $this->info("Assigning to role: {$role->display_name}"); $assigned = 0; foreach ($permissions as $permission) { $exists = DB::table('role_permissions') ->where('role_id', $role->id) ->where('permission_id', $permission->id) ->exists(); if (!$exists) { DB::table('role_permissions')->insert([ 'role_id' => $role->id, 'permission_id' => $permission->id, 'created_at' => now(), 'updated_at' => now() ]); $assigned++; } } $total = DB::table('role_permissions')->where('role_id', $role->id)->count(); $this->info("Assigned {$assigned} new permissions"); $this->info("Role now has {$total} total permissions"); // Check for users.view specifically $usersView = DB::table('role_permissions') ->join('permissions', 'role_permissions.permission_id', '=', 'permissions.id') ->where('role_permissions.role_id', $role->id) ->where('permissions.name', 'users.view') ->exists(); $this->info("users.view permission: " . ($usersView ? "✓ ASSIGNED" : "✗ MISSING")); return 0; } }