1
|
|
|
<?php namespace Arcanesoft\Blog\Seeds; |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Auth\Seeds\PermissionsSeeder; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class PermissionsTableSeeder |
7
|
|
|
* |
8
|
|
|
* @package Arcanesoft\Blog\Seeds |
9
|
|
|
* @author ARCANEDEV <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class PermissionsTableSeeder extends PermissionsSeeder |
12
|
|
|
{ |
13
|
|
|
/* ------------------------------------------------------------------------------------------------ |
14
|
|
|
| Main Functions |
15
|
|
|
| ------------------------------------------------------------------------------------------------ |
16
|
|
|
*/ |
17
|
|
|
/** |
18
|
|
|
* Run the database seeds. |
19
|
|
|
*/ |
20
|
|
|
public function run() |
21
|
|
|
{ |
22
|
|
|
$this->seed([ |
23
|
|
|
[ |
24
|
|
|
'group' => [ |
25
|
|
|
'name' => 'Blog', |
26
|
|
|
'slug' => 'blog', |
27
|
|
|
'description' => 'Blog permissions group', |
28
|
|
|
], |
29
|
|
|
'permissions' => array_merge( |
30
|
|
|
$this->getPostsSeeds(), |
31
|
|
|
$this->getCategoriesSeeds(), |
32
|
|
|
$this->getTagsSeeds() |
33
|
|
|
), |
34
|
|
|
], |
35
|
|
|
]); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/* ------------------------------------------------------------------------------------------------ |
39
|
|
|
| Other Functions |
40
|
|
|
| ------------------------------------------------------------------------------------------------ |
41
|
|
|
*/ |
42
|
|
|
/** |
43
|
|
|
* Get the Posts permissions. |
44
|
|
|
* |
45
|
|
|
* @return array |
46
|
|
|
*/ |
47
|
|
|
private function getPostsSeeds() |
48
|
|
|
{ |
49
|
|
|
return [ |
50
|
|
|
[ |
51
|
|
|
'name' => 'Posts - List all posts', |
52
|
|
|
'description' => 'Allow to list all posts.', |
53
|
|
|
'slug' => 'blog.posts.list', |
54
|
|
|
],[ |
55
|
|
|
'name' => 'Posts - View a post', |
56
|
|
|
'description' => 'Allow to display a post.', |
57
|
|
|
'slug' => 'blog.posts.show', |
58
|
|
|
],[ |
59
|
|
|
'name' => 'Posts - Create a post', |
60
|
|
|
'description' => 'Allow to create a post.', |
61
|
|
|
'slug' => 'blog.posts.create', |
62
|
|
|
],[ |
63
|
|
|
'name' => 'Posts - Update a post', |
64
|
|
|
'description' => 'Allow to update a post.', |
65
|
|
|
'slug' => 'blog.posts.update', |
66
|
|
|
],[ |
67
|
|
|
'name' => 'Posts - Delete a post', |
68
|
|
|
'description' => 'Allow to delete a post.', |
69
|
|
|
'slug' => 'blog.posts.delete', |
70
|
|
|
] |
71
|
|
|
]; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Get the Categories permissions. |
76
|
|
|
* |
77
|
|
|
* @return array |
78
|
|
|
*/ |
79
|
|
|
private function getCategoriesSeeds() |
80
|
|
|
{ |
81
|
|
|
return [ |
82
|
|
|
[ |
83
|
|
|
'name' => 'Categories - List all posts', |
84
|
|
|
'description' => 'Allow to list all categories.', |
85
|
|
|
'slug' => 'blog.categories.list', |
86
|
|
|
],[ |
87
|
|
|
'name' => 'Categories - View a category', |
88
|
|
|
'description' => 'Allow to display a category.', |
89
|
|
|
'slug' => 'blog.categories.show', |
90
|
|
|
],[ |
91
|
|
|
'name' => 'Categories - Create a category', |
92
|
|
|
'description' => 'Allow to create a category.', |
93
|
|
|
'slug' => 'blog.categories.create', |
94
|
|
|
],[ |
95
|
|
|
'name' => 'Categories - Update a category', |
96
|
|
|
'description' => 'Allow to update a category.', |
97
|
|
|
'slug' => 'blog.categories.update', |
98
|
|
|
],[ |
99
|
|
|
'name' => 'Categories - Delete a category', |
100
|
|
|
'description' => 'Allow to delete a category.', |
101
|
|
|
'slug' => 'blog.categories.delete', |
102
|
|
|
] |
103
|
|
|
]; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Get the Tags permissions. |
108
|
|
|
* |
109
|
|
|
* @return array |
110
|
|
|
*/ |
111
|
|
|
private function getTagsSeeds() |
112
|
|
|
{ |
113
|
|
|
return [ |
114
|
|
|
[ |
115
|
|
|
'name' => 'Tags - List all tags', |
116
|
|
|
'description' => 'Allow to list all tags.', |
117
|
|
|
'slug' => 'blog.tags.list', |
118
|
|
|
],[ |
119
|
|
|
'name' => 'Tags - View a tag', |
120
|
|
|
'description' => 'Allow to display a tag.', |
121
|
|
|
'slug' => 'blog.tags.show', |
122
|
|
|
],[ |
123
|
|
|
'name' => 'Tags - Create a tag', |
124
|
|
|
'description' => 'Allow to create a tag.', |
125
|
|
|
'slug' => 'blog.tags.create', |
126
|
|
|
],[ |
127
|
|
|
'name' => 'Tags - Update a tag', |
128
|
|
|
'description' => 'Allow to update a tag.', |
129
|
|
|
'slug' => 'blog.tags.update', |
130
|
|
|
],[ |
131
|
|
|
'name' => 'Tags - Delete a tag', |
132
|
|
|
'description' => 'Allow to delete a tag.', |
133
|
|
|
'slug' => 'blog.tags.delete', |
134
|
|
|
] |
135
|
|
|
]; |
136
|
|
|
} |
137
|
|
|
} |
138
|
|
|
|