Completed
Push — master ( 86d99d...6f16b0 )
by Manel
02:43
created

EnrollmentPermissionSeeder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 14 1
1
<?php
2
3
namespace Scool\EnrollmentMobile\Database\Seeds;
4
5
6
use Illuminate\Database\Seeder;
7
use Illuminate\Support\Facades\Auth;
8
use Spatie\Permission\Contracts\Permission;
9
use Spatie\Permission\Contracts\Role;
10
11
class EnrollmentPermissionSeeder extends Seeder
12
{
13
14
    /**
15
     * Run the database seeds.
16
     *
17
     * @return void
18
     */
19
    public function run()
20
    {
21
        $user='administrator';
22
23
        Permission::create(['name' => 'edit enrollments']);
24
        Permission::create(['name' => 'show enrollments']);
25
        Permission::create(['name' => 'remove enrollments']);
26
27
        Role::create(['name' => 'administrator']);
28
29
        $user->givePermissionTo('edit enrollments');
0 ignored issues
show
Bug introduced by
The method givePermissionTo cannot be called on $user (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
30
        $user->assignRole('administrator','admin');
0 ignored issues
show
Bug introduced by
The method assignRole cannot be called on $user (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
31
32
    }
33
}