1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
namespace Modules\User\Database\Seeders;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Seeder;
class SentinelGroupSeedTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$groups = Sentinel::getRoleRepository();
// Create an Admin group
$groups->createModel()->create(
[
'name' => 'Admin',
'slug' => 'admin',
]
);
// Create an Users group
$groups->createModel()->create(
[
'name' => 'User',
'slug' => 'user',
]
);
// Save the permissions
$group = Sentinel::findRoleBySlug('admin');
$group->permissions = [
'core.sidebar.group' => true,
/* Dashboard */
'dashboard.index' => true,
'dashboard.update' => true,
'dashboard.reset' => true,
/* Workbench */
'workshop.sidebar.group' => true,
'workshop.modules.index' => true,
'workshop.modules.show' => true,
'workshop.modules.update' => true,
'workshop.modules.disable' => true,
'workshop.modules.enable' => true,
'workshop.modules.publish' => true,
'workshop.themes.index' => true,
'workshop.themes.show' => true,
'workshop.themes.publish' => true,
/* Roles */
'user.roles.index' => true,
'user.roles.create' => true,
'user.roles.edit' => true,
'user.roles.destroy' => true,
/* Users */
'user.users.index' => true,
'user.users.create' => true,
'user.users.edit' => true,
'user.users.destroy' => true,
/* API keys */
'account.api-keys.index' => true,
'account.api-keys.create' => true,
'account.api-keys.destroy' => true,
/* Menu */
'menu.menus.index' => true,
'menu.menus.create' => true,
'menu.menus.edit' => true,
'menu.menus.destroy' => true,
'menu.menuitems.index' => true,
'menu.menuitems.create' => true,
'menu.menuitems.edit' => true,
'menu.menuitems.destroy' => true,
/* Media */
'media.medias.index' => true,
'media.medias.create' => true,
'media.medias.edit' => true,
'media.medias.destroy' => true,
'media.folders.index' => true,
'media.folders.create' => true,
'media.folders.edit' => true,
'media.folders.destroy' => true,
/* Settings */
'setting.settings.index' => true,
'setting.settings.edit' => true,
/* Page */
'page.pages.index' => true,
'page.pages.create' => true,
'page.pages.edit' => true,
'page.pages.destroy' => true,
/* Translation */
'translation.translations.index' => true,
'translation.translations.edit' => true,
'translation.translations.export' => true,
'translation.translations.import' => true,
/* Tags */
'tag.tags.index' => true,
'tag.tags.create' => true,
'tag.tags.edit' => true,
'tag.tags.destroy' => true,
];
$group->save();
}
}