mirror of
https://github.com/pelican-dev/panel.git
synced 2026-05-04 18:00:48 +03:00
Show different roles CheckboxList for root admins and non root admins (#1219)
* show different roles checkbox list for root admins and non root admins * simplify saveRelationshipsUsing * remove disableOptionWhen * add migration to remove additional roles from root admins
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$rootAdmins = User::all()->filter(fn ($user) => $user->isRootAdmin());
|
||||
foreach ($rootAdmins as $rootAdmin) {
|
||||
$rootAdmin->syncRoles(Role::getRootAdmin());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// No going back
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user