2020-06-08 13:08:46 +00:00
|
|
|
<?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
|
|
|
|
*/
|
2020-07-27 08:20:29 +00:00
|
|
|
"user.create" => "Creation of new user",
|
2020-06-08 13:08:46 +00:00
|
|
|
"user.show" => "Shows another user profile.",
|
|
|
|
"user.edit" => "Allows editing of other users.",
|
|
|
|
"user.delete" => "Allows deleting of other users.",
|
2020-08-03 06:33:11 +00:00
|
|
|
"ownuser.edit" => "Allows editing of your own user",
|
2020-06-08 13:08:46 +00:00
|
|
|
|
2020-06-30 07:33:22 +00:00
|
|
|
/**
|
|
|
|
* The EVENT specific permissions
|
|
|
|
*/
|
2020-06-30 06:55:41 +00:00
|
|
|
"event.create" => "Create a new event",
|
2020-06-30 07:33:22 +00:00
|
|
|
"event.show" => "Shows a specific event",
|
|
|
|
"event.edit" => "Allows editing of events",
|
|
|
|
"event.delete" => "Allows deletion of events",
|
2020-06-08 13:08:46 +00:00
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The CONTACT specific permissions
|
|
|
|
*/
|
2020-06-30 06:55:41 +00:00
|
|
|
"contact.create" => "Creates a new contact",
|
2020-06-30 07:33:22 +00:00
|
|
|
"contact.show" => "Shows a specific contact",
|
|
|
|
"contact.edit" => "allows editing of contacts",
|
|
|
|
"contact.delete" => "Allows deletion of contacts",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The FEEDBACK specific permissions
|
|
|
|
*/
|
2020-06-30 07:33:22 +00:00
|
|
|
"feedback.create" => "Creates a new feedback message",
|
|
|
|
"feedback.show" => "Shows a specific feedback message",
|
|
|
|
"feedback.edit" => "allows editing of feedback messages",
|
|
|
|
"feedback.delete" => "allows deletion of feedback messages",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The MENUPLAN specific permissions
|
|
|
|
*/
|
2020-06-30 07:33:22 +00:00
|
|
|
"menuplan.create" => "Create a new menuplan",
|
|
|
|
"menuplan.show" => "Shows a specific menuplan",
|
|
|
|
"menuplan.edit" => "Allows editing of menuplans",
|
|
|
|
"menuplan.delete" => "Allows deletion of menuplans",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The RESOURCE CATEGORY specific permissions
|
|
|
|
*/
|
2020-06-30 07:33:22 +00:00
|
|
|
"resource.category.create" => "Create a new resource category",
|
|
|
|
"resource.category.show" => "Shows a specific resource category",
|
|
|
|
"resource.category.edit" => "Allows editing of resource categories",
|
|
|
|
"resource.category.delete" => "Allows deletion of resource categories",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The RESOURCE EXTENSION specific permissions
|
|
|
|
*/
|
2020-06-30 07:33:22 +00:00
|
|
|
"resource.extension.create" => "Create a new resource extension",
|
|
|
|
"resource.extension.show" => "Shows a specific resource extension",
|
|
|
|
"resource.extension.edit" => "Allows editing of resource extensions",
|
|
|
|
"resource.extension.delete" => "Allows deletion of resource extensions",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The RESOURCE specific permissions
|
|
|
|
*/
|
2020-06-30 07:33:22 +00:00
|
|
|
"resource.create" => "Create a new resource",
|
|
|
|
"resource.show" => "Shows a specific resource",
|
|
|
|
"resource.edit" => "Allows editing of resources",
|
|
|
|
"resource.delete" => "Allows deletion of resources",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The WASHING MACHINE specific permissions
|
|
|
|
*/
|
2020-06-30 07:33:22 +00:00
|
|
|
"washing.machine.create" => "Create a new washing machine",
|
|
|
|
"washing.machine.show" => "Shows a specific washing machine",
|
|
|
|
"washing.machine.edit" => "Allows editing of washing machines",
|
|
|
|
"washing.machine.delete" => "Allows deletion of washing machines",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The WASHING MACHINE RESERVATION specific permissions
|
|
|
|
*/
|
2020-06-30 07:33:22 +00:00
|
|
|
"washing.machine.reservation.create" => "Create a new washing machine reservation",
|
|
|
|
"washing.machine.reservation.show" => "Shows a specific washing machine reservation",
|
|
|
|
"washing.machine.reservation.edit" => "Allows editing of washing machine reservations",
|
|
|
|
"washing.machine.reservation.delete" => "Allows deletion of washing machine reservations",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The ROLES specific permissions
|
|
|
|
*/
|
2020-07-29 10:30:05 +00:00
|
|
|
"roles.create" => "Create a new role",
|
|
|
|
"roles.show" => "Shows a specific role",
|
|
|
|
"roles.edit" => "Allows editing of roles",
|
|
|
|
"roles.delete" => "Allows deletion of roles",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The GUIDE specific permissions
|
|
|
|
*/
|
|
|
|
"guides.create" => "Create a new guide",
|
|
|
|
"guides.show" => "Shows a specific guide",
|
|
|
|
"guides.edit" => "Allows editing of guides",
|
|
|
|
"guides.delete" => "Allows deletion of guides",
|
2020-07-29 10:30:05 +00:00
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The LOCATION specific permissions
|
|
|
|
*/
|
|
|
|
"locations.create" => "Create a new location",
|
|
|
|
"locations.show" => "Shows a specific location",
|
|
|
|
"locations.edit" => "Allows editing of locations",
|
|
|
|
"locations.delete" => "Allows deletion of locations",
|
|
|
|
|
2020-08-06 10:21:19 +00:00
|
|
|
/**
|
|
|
|
* The NEWS specific permissions
|
|
|
|
*/
|
|
|
|
"news.create" => "Create a new location",
|
|
|
|
"news.show" => "Shows a specific location",
|
|
|
|
"news.edit" => "Allows editing of locations",
|
|
|
|
"news.delete" => "Allows deletion of locations",
|
|
|
|
|
2020-08-06 06:37:16 +00:00
|
|
|
/**
|
|
|
|
* The ADMIN PANEL specific permissions
|
|
|
|
*/
|
|
|
|
"admin.panel.show" => "Allows access to administration panel",
|
2020-06-08 13:08:46 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
foreach ($permissions as $key => $value) {
|
|
|
|
|
2020-06-30 06:55:41 +00:00
|
|
|
try {
|
|
|
|
if(Permission::findByName($key))
|
|
|
|
continue;
|
|
|
|
} catch (Exception $e) {
|
|
|
|
$permission = new Permission();
|
2020-06-08 13:08:46 +00:00
|
|
|
|
2020-06-30 06:55:41 +00:00
|
|
|
$permission->name = $key;
|
|
|
|
$permission->description = $value;
|
2020-06-08 13:08:46 +00:00
|
|
|
|
2020-06-30 06:55:41 +00:00
|
|
|
$permission->save();
|
|
|
|
}
|
2020-06-08 13:08:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|