Complete foundation for the EZSCALE billing platform replacing WHMCS: - Install Composer deps (Fortify, Passport, Cashier, PayPal, Spatie Permissions, Inertia) - Install Vue 3 + Inertia.js with Vite, 3 layouts (App, Auth, Admin) - Configure subdomain routing (marketing, account, admin) with domain-based route files - Create 30 database migrations (15 custom tables + package defaults) - Create 14 Eloquent models with relationships, factories, and encrypted casts - Set up Fortify auth with 7 Vue pages (Login, Register, ForgotPassword, ResetPassword, VerifyEmail, ConfirmPassword, TwoFactorChallenge) - Add 2FA TOTP setup page with QR code and recovery codes - Configure middleware (Inertia, Spatie roles/permissions, EnsureUserNotSuspended) - Create seeders for roles/permissions, sample plans, and admin user - Build dashboard controllers and Vue pages for customer and admin panels - Add 4 shared Vue components (Card, Button, NavLink, FlashMessages) - Generate Passport OAuth2 keys for future SSO/API use - Write 24 Pest tests (auth, role-based access, models) — all passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
879 B
PHP
37 lines
879 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Spatie\Permission\Models\Permission;
|
|
use Spatie\Permission\Models\Role;
|
|
|
|
class RoleAndPermissionSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
|
|
|
$permissions = [
|
|
'manage users',
|
|
'manage services',
|
|
'manage plans',
|
|
'manage invoices',
|
|
'manage coupons',
|
|
'view audit logs',
|
|
'impersonate users',
|
|
];
|
|
|
|
foreach ($permissions as $permission) {
|
|
Permission::create(['name' => $permission]);
|
|
}
|
|
|
|
$adminRole = Role::create(['name' => 'admin']);
|
|
$adminRole->givePermissionTo(Permission::all());
|
|
|
|
Role::create(['name' => 'customer']);
|
|
}
|
|
}
|