Code Duplication    Length = 47-54 lines in 2 locations

src/Modules/Acl/Http/Controllers/GroupController.php 1 location

@@ 12-58 (lines=47) @@
9
use App\Modules\Acl\Http\Requests\InsertGroup;
10
use App\Modules\Acl\Http\Requests\UpdateGroup;
11
12
class GroupController extends BaseApiController
13
{
14
    /**
15
     * Init new object.
16
     *
17
     * @param   GroupRepository $repo
18
     * @param   CoreConfig      $config
19
     * @return  void
20
     */
21
    public function __construct(GroupRepository $repo, CoreConfig $config)
22
    {
23
        parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclGroup');
24
    }
25
26
    /**
27
     * Insert the given model to storage.
28
     *
29
     * @param InsertGroup $request
30
     * @return \Illuminate\Http\Response
31
     */
32
    public function insert(InsertGroup $request)
33
    {
34
        return new $this->modelResource($this->repo->save($request->all()));
35
    }
36
37
    /**
38
     * Update the given model to storage.
39
     *
40
     * @param UpdateGroup $request
41
     * @return \Illuminate\Http\Response
42
     */
43
    public function update(UpdateGroup $request)
44
    {
45
        return new $this->modelResource($this->repo->save($request->all()));
46
    }
47
48
    /**
49
     * Handle an assign permissions to group request.
50
     *
51
     * @param  AssignPermissions $request
52
     * @return \Illuminate\Http\Response
53
     */
54
    public function assignPermissions(AssignPermissions $request)
55
    {
56
        return new $this->modelResource($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids')));
57
    }
58
}
59

src/Modules/Notifications/Http/Controllers/PushNotificationDeviceController.php 1 location

@@ 12-65 (lines=54) @@
9
use App\Modules\Notifications\Http\Requests\InsertPushNotificationDevice;
10
use App\Modules\Notifications\Http\Requests\UpdatePushNotificationDevice;
11
12
class PushNotificationDeviceController extends BaseApiController
13
{
14
    /**
15
     * List of all route actions that the base api controller
16
     * will skip permissions check for them.
17
     * @var array
18
     */
19
    protected $skipPermissionCheck = ['registerDevice'];
20
21
    /**
22
     * Init new object.
23
     *
24
     * @param   PushNotificationDeviceRepository $repo
25
     * @param   CoreConfig                       $config
26
     * @return  void
27
     */
28
    public function __construct(PushNotificationDeviceRepository $repo, CoreConfig $config)
29
    {
30
        parent::__construct($repo, $config, 'App\Modules\Notifications\Http\Resources\PushNotificationDevice');
31
    }
32
33
    /**
34
     * Insert the given model to storage.
35
     *
36
     * @param InsertPushNotificationDevice $request
37
     * @return \Illuminate\Http\Response
38
     */
39
    public function insert(InsertPushNotificationDevice $request)
40
    {
41
        return new $this->modelResource($this->repo->save($request->all()));
42
    }
43
44
    /**
45
     * Update the given model to storage.
46
     *
47
     * @param UpdatePushNotificationDevice $request
48
     * @return \Illuminate\Http\Response
49
     */
50
    public function update(UpdatePushNotificationDevice $request)
51
    {
52
        return new $this->modelResource($this->repo->save($request->all()));
53
    }
54
55
    /**
56
     * Register the given device to the logged in user.
57
     *
58
     * @param RegisterDevice $request
59
     * @return \Illuminate\Http\Response
60
     */
61
    public function registerDevice(RegisterDevice $request)
62
    {
63
        return new $this->modelResource($this->repo->registerDevice($request->all()));
64
    }
65
}
66