Commit 41964e8 1 parent 96bd3ad commit 41964e8 Copy full SHA for 41964e8
File tree 2 files changed +30
-8
lines changed
2 files changed +30
-8
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
3
return [
4
- 'prefix ' => 'admin ' ,
5
- 'namespace ' => '\CodexShaper\Permission ' ,
6
- 'controller_namespace ' => '\CodexShaper\Permission\Http\Controllers ' ,
4
+ 'prefix ' => 'admin ' ,
5
+ 'namespace ' => '\CodexShaper\Permission ' ,
6
+ 'controller_namespace ' => '\CodexShaper\Permission\Http\Controllers ' ,
7
7
'models ' => [
8
8
'permission ' => CodexShaper \Permission \Models \Permission::class,
9
9
'role ' => CodexShaper \Permission \Models \Role::class,
14
14
'permissions ' => 'permissions ' ,
15
15
'permission_role ' => 'permission_role ' ,
16
16
],
17
- 'resources_path ' => 'package /laravel-permission/resources/assets/ ' ,
17
+ 'resources_path ' => 'vendor/codexshaper /laravel-permission/resources/assets/ ' ,
18
18
19
19
];
Original file line number Diff line number Diff line change 5
5
*/
6
6
if ( !function_exists ('slug ' ) ) {
7
7
function slug ($ string ) {
8
- return str_slug ($ string );
9
- }
8
+ // replace non letter or digits by -
9
+ $ string = preg_replace ('~[^\pL\d]+~u ' , '- ' , $ string );
10
+
11
+ // transliterate
12
+ $ string = iconv ('utf-8 ' , 'us-ascii//TRANSLIT ' , $ string );
13
+
14
+ // remove unwanted characters
15
+ $ string = preg_replace ('~[^-\w]+~ ' , '' , $ string );
16
+
17
+ // trim
18
+ $ string = trim ($ string , '- ' );
19
+
20
+ // remove duplicate -
21
+ $ string = preg_replace ('~-+~ ' , '- ' , $ string );
22
+
23
+ // lowercase
24
+ $ string = strtolower ($ string );
25
+
26
+ if (empty ($ string )) {
27
+ return 'n-a ' ;
28
+ }
29
+
30
+ return $ string ;
31
+ }
10
32
}
11
33
if ( !function_exists ('str_spliter ' ) ) {
12
34
function str_spliter ( $ str , $ pattern = '/[\s,.|]/ ' ) {
13
- return preg_split ( $ pattern , $ str );
14
- }
35
+ return preg_split ( $ pattern , $ str );
36
+ }
15
37
}
16
38
if ( !function_exists ('permission_asset ' ) ) {
17
39
function permission_asset ( $ path ) {
You can’t perform that action at this time.
0 commit comments