59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Spatie\Permission\Models\Permission;
|
|
|
|
|
|
class PermissionSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$permissions = [
|
|
/**
|
|
* The USER specific permissions
|
|
*/
|
|
"user.list" => "Access to list the users.",
|
|
"user.show" => "Shows another user profile.",
|
|
"user.edit" => "Allows editing of other users.",
|
|
"user.delete" => "Allows deleting of other users.",
|
|
|
|
/**
|
|
* The CALENDAR specific permissions
|
|
*/
|
|
"calendar.create" => "Create a new event.",
|
|
"calendar.list" => "Shows all events.",
|
|
"calendar.show" => "Shows a specific event.",
|
|
"calendar.edit" => "Allows editing of events.",
|
|
"calendar.delete" => "Allows the deletion of events.",
|
|
|
|
/**
|
|
* The EXTERNAL LINK specific permissions
|
|
*/
|
|
"link.external.create" => "Create a new external link.",
|
|
"link.external.list" => "List all external links.",
|
|
"link.external.show" => "Show a specific external link",
|
|
"link.external.edit" => "Allows editing of external links.",
|
|
"link.external.delete" => "Allows deletion of external links",
|
|
|
|
|
|
];
|
|
|
|
foreach ($permissions as $key => $value) {
|
|
// if(Permission::findByName($key))
|
|
// continue;
|
|
|
|
$permission = new Permission();
|
|
|
|
$permission->name = $key;
|
|
$permission->description = $value;
|
|
|
|
$permission->save();
|
|
}
|
|
}
|
|
}
|