@@ -32,14 +32,14 @@ |
||
32 | 32 | |
33 | 33 | private function removeUsers(Role $role) |
34 | 34 | { |
35 | - foreach($this->userRole->getUsersThroughRole($role) as $user) { |
|
35 | + foreach ($this->userRole->getUsersThroughRole($role) as $user) { |
|
36 | 36 | $this->userRole->removeUserFromRole($user, $role); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | 40 | private function removeTags(Role $role) |
41 | 41 | { |
42 | - foreach($this->roleRoleTag->getTagsThroughRole($role) as $tag) { |
|
42 | + foreach ($this->roleRoleTag->getTagsThroughRole($role) as $tag) { |
|
43 | 43 | $this->roleRoleTag->removeTagFromRole($tag, $role); |
44 | 44 | } |
45 | 45 | } |
@@ -32,14 +32,14 @@ |
||
32 | 32 | |
33 | 33 | private function deleteRoles(Position $position) |
34 | 34 | { |
35 | - foreach($this->roleRepository->allThroughPosition($position) as $role) { |
|
35 | + foreach ($this->roleRepository->allThroughPosition($position) as $role) { |
|
36 | 36 | $this->roleRepository->delete($role->id()); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | 40 | private function removeTags(Position $position) |
41 | 41 | { |
42 | - foreach($this->positionPositionTag->getTagsThroughPosition($position) as $tag) { |
|
42 | + foreach ($this->positionPositionTag->getTagsThroughPosition($position) as $tag) { |
|
43 | 43 | $this->positionPositionTag->removeTagFromPosition($tag, $position); |
44 | 44 | } |
45 | 45 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | public function update(DataUser $oldDataUser, DataUser $newDataUser) |
23 | 23 | { |
24 | - $this->cache->forget(DataUserCache::class . '@getById:' . $newDataUser->id()); |
|
24 | + $this->cache->forget(DataUserCache::class.'@getById:'.$newDataUser->id()); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -44,16 +44,16 @@ |
||
44 | 44 | */ |
45 | 45 | public function handle() |
46 | 46 | { |
47 | - $time=-hrtime(true); |
|
47 | + $time = -hrtime(true); |
|
48 | 48 | Exporter::driver($this->option('exporter'))->export($this->exportData()); |
49 | 49 | $this->info('Export complete'); |
50 | - $time+=hrtime(true); |
|
50 | + $time += hrtime(true); |
|
51 | 51 | $this->info(sprintf('Export took %.2f s to run', $time / 1e+9)); |
52 | 52 | } |
53 | 53 | |
54 | 54 | private function exportData() |
55 | 55 | { |
56 | - switch($this->argument('type')) { |
|
56 | + switch ($this->argument('type')) { |
|
57 | 57 | case 'user': |
58 | 58 | return app(User::class)->all(); |
59 | 59 | break; |
@@ -21,31 +21,31 @@ |
||
21 | 21 | |
22 | 22 | public function create(RoleModel $roleModel) |
23 | 23 | { |
24 | - $this->cache->forget(RoleCache::class . '@count'); |
|
25 | - $this->cache->forget(RoleCache::class . '@getByDataProviderId:' . $roleModel->dataProviderId()); |
|
26 | - $this->cache->forget(RoleCache::class . '@allThroughGroup:' . $roleModel->groupId()); |
|
27 | - $this->cache->forget(RoleCache::class . '@allThroughPosition:' . $roleModel->positionId()); |
|
24 | + $this->cache->forget(RoleCache::class.'@count'); |
|
25 | + $this->cache->forget(RoleCache::class.'@getByDataProviderId:'.$roleModel->dataProviderId()); |
|
26 | + $this->cache->forget(RoleCache::class.'@allThroughGroup:'.$roleModel->groupId()); |
|
27 | + $this->cache->forget(RoleCache::class.'@allThroughPosition:'.$roleModel->positionId()); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function delete(RoleModel $role) |
31 | 31 | { |
32 | - $this->cache->forget(RoleCache::class . '@count'); |
|
33 | - $this->cache->forget(RoleCache::class . '@getById:' . $role->id()); |
|
34 | - $this->cache->forget(RoleCache::class . '@getByDataProviderId:' . $role->dataProviderId()); |
|
35 | - $this->cache->forget(RoleCache::class . '@allThroughGroup:' . $role->groupId()); |
|
36 | - $this->cache->forget(RoleCache::class . '@allThroughPosition:' . $role->positionId()); |
|
32 | + $this->cache->forget(RoleCache::class.'@count'); |
|
33 | + $this->cache->forget(RoleCache::class.'@getById:'.$role->id()); |
|
34 | + $this->cache->forget(RoleCache::class.'@getByDataProviderId:'.$role->dataProviderId()); |
|
35 | + $this->cache->forget(RoleCache::class.'@allThroughGroup:'.$role->groupId()); |
|
36 | + $this->cache->forget(RoleCache::class.'@allThroughPosition:'.$role->positionId()); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function update(RoleModel $oldRole, RoleModel $newRole) |
40 | 40 | { |
41 | - $this->cache->forget(RoleCache::class . '@count'); |
|
42 | - $this->cache->forget(RoleCache::class . '@getById:' . $newRole->id()); |
|
43 | - $this->cache->forget(RoleCache::class . '@getByDataProviderId:' . $oldRole->dataProviderId()); |
|
44 | - $this->cache->forget(RoleCache::class . '@getByDataProviderId:' . $newRole->dataProviderId()); |
|
45 | - $this->cache->forget(RoleCache::class . '@allThroughPosition:' . $oldRole->positionId()); |
|
46 | - $this->cache->forget(RoleCache::class . '@allThroughPosition:' . $newRole->positionId()); |
|
47 | - $this->cache->forget(RoleCache::class . '@allThroughGroup:' . $oldRole->groupId()); |
|
48 | - $this->cache->forget(RoleCache::class . '@allThroughGroup:' . $newRole->groupId()); |
|
41 | + $this->cache->forget(RoleCache::class.'@count'); |
|
42 | + $this->cache->forget(RoleCache::class.'@getById:'.$newRole->id()); |
|
43 | + $this->cache->forget(RoleCache::class.'@getByDataProviderId:'.$oldRole->dataProviderId()); |
|
44 | + $this->cache->forget(RoleCache::class.'@getByDataProviderId:'.$newRole->dataProviderId()); |
|
45 | + $this->cache->forget(RoleCache::class.'@allThroughPosition:'.$oldRole->positionId()); |
|
46 | + $this->cache->forget(RoleCache::class.'@allThroughPosition:'.$newRole->positionId()); |
|
47 | + $this->cache->forget(RoleCache::class.'@allThroughGroup:'.$oldRole->groupId()); |
|
48 | + $this->cache->forget(RoleCache::class.'@allThroughGroup:'.$newRole->groupId()); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
52 | 52 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $groups = $this->getAllWhere($attributes); |
31 | 31 | |
32 | - if($groups->count() > 0) { |
|
32 | + if ($groups->count() > 0) { |
|
33 | 33 | return $groups->first(); |
34 | 34 | } |
35 | 35 | throw (new ModelNotFoundException())->setModel(DataGroup::class); |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | return \BristolSU\ControlDB\Models\DataGroup::where(function($query) use ($baseAttributes) { |
70 | - foreach($baseAttributes as $key => $value) { |
|
71 | - $query = $query->where($key, 'LIKE', '%' . $value . '%'); |
|
70 | + foreach ($baseAttributes as $key => $value) { |
|
71 | + $query = $query->where($key, 'LIKE', '%'.$value.'%'); |
|
72 | 72 | } |
73 | 73 | return $query; |
74 | - })->get()->filter(function (\BristolSU\ControlDB\Models\DataGroup $dataGroup) use ($additionalAttributes) { |
|
74 | + })->get()->filter(function(\BristolSU\ControlDB\Models\DataGroup $dataGroup) use ($additionalAttributes) { |
|
75 | 75 | foreach ($additionalAttributes as $additionalAttribute => $value) { |
76 | 76 | if ($dataGroup->getAdditionalAttribute($additionalAttribute) !== $value) { |
77 | 77 | return false; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $positions = $this->getAllWhere($attributes); |
33 | 33 | |
34 | - if($positions->count() > 0) { |
|
34 | + if ($positions->count() > 0) { |
|
35 | 35 | return $positions->first(); |
36 | 36 | } |
37 | 37 | throw (new ModelNotFoundException())->setModel(DataPosition::class); |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | return \BristolSU\ControlDB\Models\DataPosition::where(function($query) use ($baseAttributes) { |
72 | - foreach($baseAttributes as $key => $value) { |
|
73 | - $query = $query->where($key, 'LIKE', '%' . $value . '%'); |
|
72 | + foreach ($baseAttributes as $key => $value) { |
|
73 | + $query = $query->where($key, 'LIKE', '%'.$value.'%'); |
|
74 | 74 | } |
75 | 75 | return $query; |
76 | - })->get()->filter(function (\BristolSU\ControlDB\Models\DataPosition $dataPosition) use ($additionalAttributes) { |
|
76 | + })->get()->filter(function(\BristolSU\ControlDB\Models\DataPosition $dataPosition) use ($additionalAttributes) { |
|
77 | 77 | foreach ($additionalAttributes as $additionalAttribute => $value) { |
78 | 78 | if ($dataPosition->getAdditionalAttribute($additionalAttribute) !== $value) { |
79 | 79 | return false; |
@@ -74,11 +74,11 @@ |
||
74 | 74 | } |
75 | 75 | } |
76 | 76 | return \BristolSU\ControlDB\Models\DataUser::where(function($query) use ($baseAttributes) { |
77 | - foreach($baseAttributes as $key => $value) { |
|
78 | - $query = $query->where($key, 'LIKE', '%' . $value . '%'); |
|
77 | + foreach ($baseAttributes as $key => $value) { |
|
78 | + $query = $query->where($key, 'LIKE', '%'.$value.'%'); |
|
79 | 79 | } |
80 | 80 | return $query; |
81 | - })->get()->filter(function (\BristolSU\ControlDB\Models\DataUser $dataUser) use ($additionalAttributes) { |
|
81 | + })->get()->filter(function(\BristolSU\ControlDB\Models\DataUser $dataUser) use ($additionalAttributes) { |
|
82 | 82 | foreach ($additionalAttributes as $additionalAttribute => $value) { |
83 | 83 | if ($dataUser->getAdditionalAttribute($additionalAttribute) !== $value) { |
84 | 84 | return false; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $roles = $this->getAllWhere($attributes); |
33 | 33 | |
34 | - if($roles->count() > 0) { |
|
34 | + if ($roles->count() > 0) { |
|
35 | 35 | return $roles->first(); |
36 | 36 | } |
37 | 37 | throw (new ModelNotFoundException())->setModel(DataRole::class); |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | return \BristolSU\ControlDB\Models\DataRole::where(function($query) use ($baseAttributes) { |
72 | - foreach($baseAttributes as $key => $value) { |
|
73 | - $query = $query->where($key, 'LIKE', '%' . $value . '%'); |
|
72 | + foreach ($baseAttributes as $key => $value) { |
|
73 | + $query = $query->where($key, 'LIKE', '%'.$value.'%'); |
|
74 | 74 | } |
75 | 75 | return $query; |
76 | - })->get()->filter(function (\BristolSU\ControlDB\Models\DataRole $dataRole) use ($additionalAttributes) { |
|
76 | + })->get()->filter(function(\BristolSU\ControlDB\Models\DataRole $dataRole) use ($additionalAttributes) { |
|
77 | 77 | foreach ($additionalAttributes as $additionalAttribute => $value) { |
78 | 78 | if ($dataRole->getAdditionalAttribute($additionalAttribute) !== $value) { |
79 | 79 | return false; |