-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset-admin.php
More file actions
39 lines (32 loc) · 1018 Bytes
/
Copy pathreset-admin.php
File metadata and controls
39 lines (32 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
use App\Models\User;
use Illuminate\Support\Facades\Hash;
// Find or create admin user
$admin = User::where('email', 'admin@example.com')->first();
if ($admin) {
$admin->update([
'password' => Hash::make('admin123'),
'user_type' => 'admin',
]);
echo "Admin user updated. Password: admin123\n";
} else {
$admin = User::create([
'name' => 'Super Admin',
'email' => 'admin@example.com',
'password' => Hash::make('admin123'),
'user_type' => 'admin',
]);
echo "Admin user created. Password: admin123\n";
}
// Give admin role if using Spatie
if (method_exists($admin, 'assignRole')) {
$admin->assignRole('super_admin');
echo "Assigned super_admin role\n";
}
echo "Login at: /admin\n";
echo "Email: admin@example.com\n";
echo "Password: admin123\n";