Completed
Push — master ( 8105e1...29833d )
by Manel
02:50
created

CoursePermissionSeeder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 23
loc 23
ccs 0
cts 14
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 14 14 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Scool\EnrollmentMobile\Database\Seeds;
4
5
use Illuminate\Database\Seeder;
6
use Spatie\Permission\Models\Permission;
7
use Spatie\Permission\Models\Role;
8
9
/**
10
 * Class EnrollmentPermissionSeeder
11
 * @package Scool\EnrollmentMobile\Database\Seeds
12
 */
13 View Code Duplication
class CoursePermissionSeeder extends Seeder
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
16
    /**>
17
     * Run the database seeds.
18
     *
19
     * @return void
20
     */
21
    public function run()
22
    {
23
        Permission::create(['name' => 'browse courses']);
0 ignored issues
show
Bug introduced by
The method create() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean created()?

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
        Permission::create(['name' => 'read courses']);
0 ignored issues
show
Bug introduced by
The method create() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean created()?

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...
25
        Permission::create(['name' => 'edit courses']);
0 ignored issues
show
Bug introduced by
The method create() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean created()?

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::create(['name' => 'add courses']);
0 ignored issues
show
Bug introduced by
The method create() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean created()?

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
        Permission::create(['name' => 'delete courses']);
0 ignored issues
show
Bug introduced by
The method create() does not exist on Spatie\Permission\Models\Permission. Did you maybe mean created()?

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...
28
        $role = Role::create(['name' => 'manage courses']);
0 ignored issues
show
Bug introduced by
The method create() does not exist on Spatie\Permission\Models\Role. Did you maybe mean created()?

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
        $role->givePermissionTo('browse courses');
30
        $role->givePermissionTo('read courses');
31
        $role->givePermissionTo('edit courses');
32
        $role->givePermissionTo('add courses');
33
        $role->givePermissionTo('delete courses');
34
    }
35
}
36