Skip to content

Commit

Permalink
Upgrade composer and npm
Browse files Browse the repository at this point in the history
  • Loading branch information
curtisdelicata committed Jul 20, 2024
1 parent ce2d683 commit da53fda
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
17 changes: 17 additions & 0 deletions database/seeders/PermissionsSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Artisan;

class PermissionsSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Artisan::call('permissions:sync');
}
}
24 changes: 24 additions & 0 deletions database/seeders/RolesSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;

class RolesSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$adminRole = Role::firstOrCreate(['name' => 'admin']);
$permissions = Permission::where('guard_name', 'web')->pluck('id')->toArray();
$adminRole->syncPermissions($permissions);

$freeRole = Role::firstOrCreate(['name' => 'free']);
$freePermissions = Permission::where('guard_name', 'web')->pluck('id')->toArray();
$freeRole->syncPermissions($freePermissions);
}
}

0 comments on commit da53fda

Please sign in to comment.