eric98 /
articles
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use App\User; |
||
| 4 | use Spatie\Permission\Models\Permission; |
||
| 5 | use Spatie\Permission\Models\Role; |
||
| 6 | |||
| 7 | if (!function_exists('assignPermission')) { |
||
| 8 | function assignPermission($role, $permission) |
||
| 9 | { |
||
| 10 | if (! $role->hasPermissionTo($permission)) { |
||
| 11 | $role->givePermissionTo($permission); |
||
| 12 | } |
||
| 13 | } |
||
| 14 | } |
||
| 15 | |||
| 16 | if (!function_exists('initialize_articles_permissions')) { |
||
| 17 | function initialize_articles_permissions() |
||
| 18 | { |
||
| 19 | Permission::firstOrCreate(['name' => 'list-articles']); |
||
|
0 ignored issues
–
show
|
|||
| 20 | Permission::firstOrCreate(['name' => 'show-articles']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 21 | Permission::firstOrCreate(['name' => 'store-articles']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 22 | Permission::firstOrCreate(['name' => 'update-articles']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 23 | Permission::firstOrCreate(['name' => 'destroy-articles']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 24 | |||
| 25 | Permission::firstOrCreate(['name' => 'store-read-articles']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 26 | Permission::firstOrCreate(['name' => 'destroy-read-articles']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 27 | |||
| 28 | Permission::firstOrCreate(['name' => 'update-description-articles']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 29 | |||
| 30 | Permission::firstOrCreate(['name' => 'update-user_id-articles']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 31 | |||
| 32 | $role = Role::firstOrCreate(['name' => 'articles-manager']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Role. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 33 | |||
| 34 | assignPermission($role, 'list-articles'); |
||
| 35 | assignPermission($role, 'show-articles'); |
||
| 36 | assignPermission($role, 'store-articles'); |
||
| 37 | assignPermission($role, 'update-articles'); |
||
| 38 | assignPermission($role, 'destroy-articles'); |
||
| 39 | |||
| 40 | assignPermission($role, 'store-read-articles'); |
||
| 41 | assignPermission($role, 'destroy-read-articles'); |
||
| 42 | assignPermission($role, 'update-description-articles'); |
||
| 43 | assignPermission($role, 'update-user_id-articles'); |
||
| 44 | |||
| 45 | Permission::firstOrCreate(['name' => 'list-users']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 46 | Permission::firstOrCreate(['name' => 'show-user']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 47 | Permission::firstOrCreate(['name' => 'store-user']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 48 | Permission::firstOrCreate(['name' => 'update-user']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 49 | Permission::firstOrCreate(['name' => 'destroy-user']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 50 | |||
| 51 | $role = Role::firstOrCreate(['name' => 'users-manager']); |
||
|
0 ignored issues
–
show
The method
firstOrCreate() does not exist on Spatie\Permission\Models\Role. Did you maybe mean create()?
This check marks calls to methods that do not seem to exist on an object. This is most likely the result of a method being renamed without all references to it being renamed likewise. Loading history...
|
|||
| 52 | |||
| 53 | assignPermission($role, 'list-users'); |
||
| 54 | assignPermission($role, 'show-user'); |
||
| 55 | assignPermission($role, 'store-user'); |
||
| 56 | assignPermission($role, 'update-user'); |
||
| 57 | assignPermission($role, 'destroy-user'); |
||
| 58 | } |
||
| 59 | } |
||
| 60 | |||
| 61 | if (!function_exists('create_admin_user')) { |
||
| 62 | function create_admin_user() |
||
| 63 | { |
||
| 64 | factory(User::class)->create([ |
||
| 65 | 'name' => env('ARTICLES_USER_NAME', 'Eric Garcia Reverter'), |
||
| 66 | 'email' => env('ARTICLES_USER_EMAIL', '[email protected]'), |
||
| 67 | 'password' => bcrypt(env('ARTICLES_USER_PASSWORD')), |
||
| 68 | ]); |
||
| 69 | |||
| 70 | factory(User::class)->create([ |
||
| 71 | 'name' => env('ARTICLES_USER_NAME_2', 'Sergi Tur Badenas'), |
||
| 72 | 'email' => env('ARTICLES_USER_EMAIL_2', '[email protected]'), |
||
| 73 | 'password' => bcrypt(env('ARTICLES_USER_PASSWORD_2')), |
||
| 74 | ]); |
||
| 75 | } |
||
| 76 | } |
||
| 77 | |||
| 78 | if (!function_exists('first_user_as_articles_manager')) { |
||
| 79 | function first_user_as_articles_manager() |
||
|
0 ignored issues
–
show
|
|||
| 80 | { |
||
| 81 | User::all()->first()->assignRole('articles-manager'); |
||
| 82 | User::all()->first()->assignRole('users-manager'); |
||
| 83 | User::findOrFail('2')->assignRole('articles-manager'); |
||
| 84 | User::findOrFail('2')->assignRole('users-manager'); |
||
| 85 | } |
||
| 86 | } |
||
| 87 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.