Code Duplication    Length = 29-29 lines in 3 locations

src/Modules/V1/Core/Database/Seeds/AssignRelationsSeeder.php 1 location

@@ 7-35 (lines=29) @@
4
5
use Illuminate\Database\Seeder;
6
7
class AssignRelationsSeeder extends Seeder
8
{
9
    /**
10
     * Run the database seeds.
11
     *
12
     * @return void
13
     */
14
    public function run()
15
    {	
16
        /**
17
		 * Assign the permissions to the admin group.
18
		 */
19
    	$adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id;
20
21
        /**
22
         * Assign the permissions to the admin group.
23
         */
24
        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['settings', 'logs'])->each(function ($permission) use ($adminGroupId) {
25
        	\DB::table('groups_permissions')->insert(
26
				[
27
				'permission_id' => $permission->id,
28
				'group_id'      => $adminGroupId,
29
				'created_at'    => \DB::raw('NOW()'),
30
				'updated_at'    => \DB::raw('NOW()')
31
				]
32
			);
33
        });
34
    }
35
}
36

src/Modules/V1/Notifications/Database/Seeds/AssignRelationsSeeder.php 1 location

@@ 7-35 (lines=29) @@
4
5
use Illuminate\Database\Seeder;
6
7
class AssignRelationsSeeder extends Seeder
8
{
9
    /**
10
     * Run the database seeds.
11
     *
12
     * @return void
13
     */
14
    public function run()
15
    {	
16
        /**
17
		 * Assign the permissions to the admin group.
18
		 */
19
    	$adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id;
20
21
        /**
22
         * Assign the permissions to the admin group.
23
         */
24
        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['notifications', 'pushNotificationDevices'])->each(function ($permission) use ($adminGroupId) {
25
        	\DB::table('groups_permissions')->insert(
26
				[
27
				'permission_id' => $permission->id,
28
				'group_id'      => $adminGroupId,
29
				'created_at'    => \DB::raw('NOW()'),
30
				'updated_at'    => \DB::raw('NOW()')
31
				]
32
			);
33
        });
34
    }
35
}
36

src/Modules/V1/Reporting/Database/Seeds/AssignRelationsSeeder.php 1 location

@@ 7-35 (lines=29) @@
4
5
use Illuminate\Database\Seeder;
6
7
class AssignRelationsSeeder extends Seeder
8
{
9
    /**
10
     * Run the database seeds.
11
     *
12
     * @return void
13
     */
14
    public function run()
15
    {	
16
        /**
17
		 * Assign the permissions to the admin group.
18
		 */
19
    	$adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id;
20
21
        /**
22
         * Assign the permissions to the admin group.
23
         */
24
        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['reports'])->each(function ($permission) use ($adminGroupId) {
25
        	\DB::table('groups_permissions')->insert(
26
				[
27
				'permission_id' => $permission->id,
28
				'group_id'      => $adminGroupId,
29
				'created_at'    => \DB::raw('NOW()'),
30
				'updated_at'    => \DB::raw('NOW()')
31
				]
32
			);
33
        });
34
    }
35
}
36