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

EnrollmentPermissionSeeder::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 14
ccs 0
cts 10
cp 0
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
crap 2
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
}