* Product catalogue * Product categories * Physical, digital, service, and bundle product types * Product variants and option storage * SKU management * Product publishing states * Pricing and comparison pricing * Inventory quantities * Low-stock thresholds * Inventory movement history * Customer records and addresses * Orders and order items * Payment and fulfilment statuses * Payment transaction storage * Promotions and coupon codes * Shipping methods * Tax rates * Payment, shipping, tax, and inventory provider contracts * Default manual payment provider * Default flat-rate shipping provider * Public product REST API * Administration navigation * Commerce permissions * Module registration * Module boot tests
82 lines
2.2 KiB
PHP
82 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace Modules\Roles\Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Spatie\Permission\Models\Permission;
|
|
use Spatie\Permission\Models\Role;
|
|
use Spatie\Permission\PermissionRegistrar;
|
|
|
|
final class RolePermissionSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$registrar = app(PermissionRegistrar::class);
|
|
$registrar->forgetCachedPermissions();
|
|
|
|
$permissions = [
|
|
'administration.access',
|
|
'users.view',
|
|
'users.create',
|
|
'users.update',
|
|
'users.delete',
|
|
'roles.manage',
|
|
'settings.manage',
|
|
'audit.view',
|
|
'media.view',
|
|
'media.upload',
|
|
'media.update',
|
|
'media.delete',
|
|
'seo.manage',
|
|
'search.manage',
|
|
'themes.manage',
|
|
'pages.manage',
|
|
'menus.manage',
|
|
'redirects.manage',
|
|
'forms.manage',
|
|
'documents.manage',
|
|
'banners.manage',
|
|
'faq.manage',
|
|
'team.manage',
|
|
'testimonials.manage',
|
|
'blog.manage',
|
|
'news.manage',
|
|
'categories.manage',
|
|
'tags.manage',
|
|
'authors.manage',
|
|
'comments.moderate',
|
|
'crm.manage',
|
|
'newsletter.manage',
|
|
'events.manage',
|
|
'careers.manage',
|
|
'locations.manage',
|
|
'workflow.view',
|
|
'workflow.manage',
|
|
'workflow.review',
|
|
'localization.manage',
|
|
'localization.translate',
|
|
'sites.view',
|
|
'sites.manage',
|
|
'sites.assign',
|
|
'developer.access',
|
|
'api.view',
|
|
'api.manage',
|
|
'enterprise.view',
|
|
'enterprise.manage',
|
|
'commerce.view',
|
|
'commerce.manage',
|
|
'commerce.orders.manage',
|
|
'commerce.products.manage',
|
|
];
|
|
|
|
foreach ($permissions as $permission) {
|
|
Permission::findOrCreate($permission, 'web');
|
|
}
|
|
|
|
$administrator = Role::findOrCreate('admin', 'web');
|
|
$administrator->syncPermissions($permissions);
|
|
|
|
$registrar->forgetCachedPermissions();
|
|
}
|
|
}
|