Completed
Push — master ( c7d5ad...0208a8 )
by Sherif
02:59
created

GroupRepository::getModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace App\Modules\Acl\Repositories\V1;
2
3
use App\Modules\Core\AbstractRepositories\AbstractRepository;
4
5
class GroupRepository extends AbstractRepository
6
{
7
	/**
8
	 * Return the model full namespace.
9
	 * 
10
	 * @return string
11
	 */
12
	protected function getModel()
13
	{
14
		return 'App\Modules\Acl\AclGroup';
15
	}
16
17
	/**
18
	 * Assign the given permission ids to the given group.
19
	 * 
20
	 * @param  integer $group_id    
21
	 * @param  array   $permission_ids
22
	 * @return object
23
	 */
24 View Code Duplication
	public function assignPermissions($group_id, $permission_ids)
0 ignored issues
show
Duplication introduced by
This method 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...
25
	{
26
		\DB::transaction(function () use ($group_id, $permission_ids) {
27
			$group = \Core::groups()->find($group_id);
28
			$group->permissions()->detach();
29
			$group->permissions()->attach($permission_ids);
30
		});
31
32
        return \Core::groups()->find($group_id);
33
	}
34
}
35