Added first seeder.
This commit is contained in:
@@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(UserSeeder::class);
|
||||
$this->call(PermissionSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user