Files
citrus/fix-permissions.php
T
2026-02-03 02:31:54 +03:00

29 lines
635 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
use App\Models\User;
use Spatie\Permission\Models\Role;
// İlk kullanıcıyı al
$user = User::first();
if (!$user) {
echo "No user found!\n";
exit(1);
}
echo "User found: {$user->email}\n";
// Super admin rolü var mı kontrol et
$superAdminRole = Role::firstOrCreate(['name' => 'super_admin']);
// Kullanıcıya rolü ata
$user->assignRole($superAdminRole);
echo "Super admin role assigned successfully!\n";
echo "User: {$user->name} ({$user->email})\n";