Test Setup Failed
Pull Request — master (#34)
by Jeremy
04:44
created

DefaultConnectRelationshipsSeeder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 15 2
1
<?php
2
3
namespace jeremykenedy\LaravelRoles\Database\Seeds;
4
5
use Illuminate\Database\Seeder;
6
7
class DefaultConnectRelationshipsSeeder extends Seeder
8
{
9
    /**
10
     * Run the database seeds.
11
     *
12
     * @return void
13
     */
14
    public function run()
15
    {
16
        /**
17
         * Get Available Permissions.
18
         */
19
        $permissions = config('roles.models.permission')::all();
20
21
        /**
22
         * Attach Permissions to Roles.
23
         */
24
        $roleAdmin = config('roles.models.role')::where('name', '=', 'Admin')->first();
25
        echo "\e[32mSeeding:\e[0m DefaultConnectRelationshipsSeeder\r\n";
26
        foreach ($permissions as $permission) {
27
            $roleAdmin->attachPermission($permission);
28
            echo "\e[32mSeeding:\e[0m DefaultConnectRelationshipsSeeder - Role:Admin attached to Permission:".$permission->slug."\r\n";
29
        }
30
    }
31
}
32