@@ -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->orWhere($key, 'LIKE', '%' . $value . '%'); |
|
72 | + foreach ($baseAttributes as $key => $value) { |
|
73 | + $query = $query->orWhere($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; |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | public function search(Request $request, GroupRepository $groupRepository, DataGroupRepository $dataGroupRepository) |
39 | 39 | { |
40 | 40 | $search = []; |
41 | - if($request->has('name')) { |
|
41 | + if ($request->has('name')) { |
|
42 | 42 | $search['name'] = $request->input('name'); |
43 | 43 | } |
44 | - if($request->has('email')) { |
|
44 | + if ($request->has('email')) { |
|
45 | 45 | $search['email'] = $request->input('email'); |
46 | 46 | } |
47 | 47 | $dataGroups = $dataGroupRepository->getAllWhere($search); |
48 | 48 | $groups = new Collection(); |
49 | - foreach($dataGroups as $dataGroup) { |
|
49 | + foreach ($dataGroups as $dataGroup) { |
|
50 | 50 | $group = $dataGroup->group(); |
51 | - if($group !== null) { |
|
51 | + if ($group !== null) { |
|
52 | 52 | $groups->push($group); |
53 | 53 | } |
54 | 54 | } |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | $request->input('email') |
85 | 85 | ); |
86 | 86 | |
87 | - foreach($dataGroup->getAdditionalAttributes() as $additionalAttribute) { |
|
88 | - if($request->has($additionalAttribute)) { |
|
87 | + foreach ($dataGroup->getAdditionalAttributes() as $additionalAttribute) { |
|
88 | + if ($request->has($additionalAttribute)) { |
|
89 | 89 | $dataGroup->saveAdditionalAttribute($additionalAttribute, $request->input($additionalAttribute)); |
90 | 90 | } |
91 | 91 | } |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | public function update(Group $group, StoreGroupRequest $request) |
105 | 105 | { |
106 | 106 | $dataGroup = $group->data(); |
107 | - if($request->input('name') !== null) { |
|
107 | + if ($request->input('name') !== null) { |
|
108 | 108 | $dataGroup->setName($request->input('name')); |
109 | 109 | } |
110 | - if($request->input('email') !== null) { |
|
110 | + if ($request->input('email') !== null) { |
|
111 | 111 | $dataGroup->setEmail($request->input('email')); |
112 | 112 | } |
113 | 113 | |
114 | - foreach($dataGroup->getAdditionalAttributes() as $additionalAttribute) { |
|
115 | - if($request->has($additionalAttribute)) { |
|
114 | + foreach ($dataGroup->getAdditionalAttributes() as $additionalAttribute) { |
|
115 | + if ($request->has($additionalAttribute)) { |
|
116 | 116 | $dataGroup->saveAdditionalAttribute($additionalAttribute, $request->input($additionalAttribute)); |
117 | 117 | } |
118 | 118 | } |
@@ -40,20 +40,20 @@ discard block |
||
40 | 40 | public function search(Request $request, UserRepository $userRepository, DataUserRepository $dataUserRepository) |
41 | 41 | { |
42 | 42 | $search = []; |
43 | - if($request->has('first_name')) { |
|
43 | + if ($request->has('first_name')) { |
|
44 | 44 | $search['first_name'] = $request->input('first_name'); |
45 | 45 | } |
46 | - if($request->has('last_name')) { |
|
46 | + if ($request->has('last_name')) { |
|
47 | 47 | $search['last_name'] = $request->input('last_name'); |
48 | 48 | } |
49 | - if($request->has('email')) { |
|
49 | + if ($request->has('email')) { |
|
50 | 50 | $search['email'] = $request->input('email'); |
51 | 51 | } |
52 | 52 | $dataUsers = $dataUserRepository->getAllWhere($search); |
53 | 53 | $users = new Collection(); |
54 | - foreach($dataUsers as $dataUser) { |
|
54 | + foreach ($dataUsers as $dataUser) { |
|
55 | 55 | $user = $dataUser->user(); |
56 | - if($user !== null) { |
|
56 | + if ($user !== null) { |
|
57 | 57 | $users->push($user); |
58 | 58 | } |
59 | 59 | } |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $request->input('preferred_name') |
91 | 91 | ); |
92 | 92 | |
93 | - foreach($dataUser->getAdditionalAttributes() as $additionalAttribute) { |
|
94 | - if($request->has($additionalAttribute)) { |
|
93 | + foreach ($dataUser->getAdditionalAttributes() as $additionalAttribute) { |
|
94 | + if ($request->has($additionalAttribute)) { |
|
95 | 95 | $dataUser->saveAdditionalAttribute($additionalAttribute, $request->input($additionalAttribute)); |
96 | 96 | } |
97 | 97 | } |
@@ -112,24 +112,24 @@ discard block |
||
112 | 112 | { |
113 | 113 | $dataUser = $user->data(); |
114 | 114 | |
115 | - if($request->input('first_name') !== null) { |
|
115 | + if ($request->input('first_name') !== null) { |
|
116 | 116 | $dataUser->setFirstName($request->input('first_name')); |
117 | 117 | } |
118 | - if($request->input('last_name') !== null) { |
|
118 | + if ($request->input('last_name') !== null) { |
|
119 | 119 | $dataUser->setLastName($request->input('last_name')); |
120 | 120 | } |
121 | - if($request->input('email') !== null) { |
|
121 | + if ($request->input('email') !== null) { |
|
122 | 122 | $dataUser->setEmail($request->input('email')); |
123 | 123 | } |
124 | - if($request->input('dob') !== null) { |
|
124 | + if ($request->input('dob') !== null) { |
|
125 | 125 | $dataUser->setDob(Carbon::make($request->input('dob'))); |
126 | 126 | } |
127 | - if($request->input('preferred_name') !== null) { |
|
127 | + if ($request->input('preferred_name') !== null) { |
|
128 | 128 | $dataUser->setPreferredName($request->input('preferred_name')); |
129 | 129 | } |
130 | 130 | |
131 | - foreach($dataUser->getAdditionalAttributes() as $additionalAttribute) { |
|
132 | - if($request->has($additionalAttribute)) { |
|
131 | + foreach ($dataUser->getAdditionalAttributes() as $additionalAttribute) { |
|
132 | + if ($request->has($additionalAttribute)) { |
|
133 | 133 | $dataUser->saveAdditionalAttribute($additionalAttribute, $request->input($additionalAttribute)); |
134 | 134 | } |
135 | 135 | } |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function registerConfig() |
158 | 158 | { |
159 | - $this->publishes([__DIR__ .'/../config/control.php' => config_path('control.php'), |
|
159 | + $this->publishes([__DIR__.'/../config/control.php' => config_path('control.php'), |
|
160 | 160 | ], 'config'); |
161 | 161 | $this->mergeConfigFrom( |
162 | - __DIR__ .'/../config/control.php', 'control' |
|
162 | + __DIR__.'/../config/control.php', 'control' |
|
163 | 163 | ); |
164 | 164 | } |
165 | 165 | |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | public function registerFactories() |
172 | 172 | { |
173 | 173 | if (!app()->environment('production') && class_exists(\Faker\Factory::class)) { |
174 | - $this->app->make(Factory::class)->load(__DIR__ .'/../database/factories'); |
|
174 | + $this->app->make(Factory::class)->load(__DIR__.'/../database/factories'); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | 178 | public function registerMigrations() |
179 | 179 | { |
180 | - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
180 | + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | public function bindContracts() |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | Route::prefix(config('control.api_prefix')) |
306 | 306 | ->middleware(config('control.api_middleware')) |
307 | 307 | ->namespace('BristolSU\ControlDB\Http\Controllers') |
308 | - ->group(__DIR__ . '/../routes/api.php'); |
|
308 | + ->group(__DIR__.'/../routes/api.php'); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | private function setupObservers() |
@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | public function getById(int $id): \BristolSU\ControlDB\Contracts\Models\DataGroup |
34 | 34 | { |
35 | - return $this->cache->rememberForever(static::class . '@getById:' . $id, function() use ($id) { |
|
35 | + return $this->cache->rememberForever(static::class.'@getById:'.$id, function() use ($id) { |
|
36 | 36 | return $this->dataGroupRepository->getById($id); |
37 | 37 | }); |
38 | 38 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getTagByFullReference(string $reference): \BristolSU\ControlDB\Contracts\Models\Tags\RoleTag |
46 | 46 | { |
47 | - return $this->cache->rememberForever(static::class . '@getTagByFullReference:' . $reference, function() use ($reference) { |
|
47 | + return $this->cache->rememberForever(static::class.'@getTagByFullReference:'.$reference, function() use ($reference) { |
|
48 | 48 | return $this->roleTagRepository->getTagByFullReference($reference); |
49 | 49 | }); |
50 | 50 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getById(int $id): \BristolSU\ControlDB\Contracts\Models\Tags\RoleTag |
59 | 59 | { |
60 | - return $this->cache->rememberForever(static::class . '@getById:' . $id, function() use ($id) { |
|
60 | + return $this->cache->rememberForever(static::class.'@getById:'.$id, function() use ($id) { |
|
61 | 61 | return $this->roleTagRepository->getById($id); |
62 | 62 | }); |
63 | 63 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function allThroughTagCategory(\BristolSU\ControlDB\Contracts\Models\Tags\RoleTagCategory $roleTagCategory): Collection |
96 | 96 | { |
97 | - return $this->cache->rememberForever(static::class . '@allThroughTagCategory:' . $roleTagCategory->id(), function() use ($roleTagCategory) { |
|
97 | + return $this->cache->rememberForever(static::class.'@allThroughTagCategory:'.$roleTagCategory->id(), function() use ($roleTagCategory) { |
|
98 | 98 | return $this->roleTagRepository->allThroughTagCategory($roleTagCategory); |
99 | 99 | }); |
100 | 100 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getTagByFullReference(string $reference): \BristolSU\ControlDB\Contracts\Models\Tags\GroupTag |
46 | 46 | { |
47 | - return $this->cache->rememberForever(static::class . '@getTagByFullReference:' . $reference, function() use ($reference) { |
|
47 | + return $this->cache->rememberForever(static::class.'@getTagByFullReference:'.$reference, function() use ($reference) { |
|
48 | 48 | return $this->groupTagRepository->getTagByFullReference($reference); |
49 | 49 | }); |
50 | 50 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getById(int $id): \BristolSU\ControlDB\Contracts\Models\Tags\GroupTag |
59 | 59 | { |
60 | - return $this->cache->rememberForever(static::class . '@getById:' . $id, function() use ($id) { |
|
60 | + return $this->cache->rememberForever(static::class.'@getById:'.$id, function() use ($id) { |
|
61 | 61 | return $this->groupTagRepository->getById($id); |
62 | 62 | }); |
63 | 63 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function allThroughTagCategory(\BristolSU\ControlDB\Contracts\Models\Tags\GroupTagCategory $groupTagCategory): Collection |
96 | 96 | { |
97 | - return $this->cache->rememberForever(static::class . '@allThroughTagCategory:' . $groupTagCategory->id(), function() use ($groupTagCategory) { |
|
97 | + return $this->cache->rememberForever(static::class.'@allThroughTagCategory:'.$groupTagCategory->id(), function() use ($groupTagCategory) { |
|
98 | 98 | return $this->groupTagRepository->allThroughTagCategory($groupTagCategory); |
99 | 99 | }); |
100 | 100 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getTagByFullReference(string $reference): \BristolSU\ControlDB\Contracts\Models\Tags\PositionTag |
46 | 46 | { |
47 | - return $this->cache->rememberForever(static::class . '@getTagByFullReference:' . $reference, function() use ($reference) { |
|
47 | + return $this->cache->rememberForever(static::class.'@getTagByFullReference:'.$reference, function() use ($reference) { |
|
48 | 48 | return $this->positionTagRepository->getTagByFullReference($reference); |
49 | 49 | }); |
50 | 50 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getById(int $id): \BristolSU\ControlDB\Contracts\Models\Tags\PositionTag |
59 | 59 | { |
60 | - return $this->cache->rememberForever(static::class . '@getById:' . $id, function() use ($id) { |
|
60 | + return $this->cache->rememberForever(static::class.'@getById:'.$id, function() use ($id) { |
|
61 | 61 | return $this->positionTagRepository->getById($id); |
62 | 62 | }); |
63 | 63 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function allThroughTagCategory(\BristolSU\ControlDB\Contracts\Models\Tags\PositionTagCategory $positionTagCategory): Collection |
96 | 96 | { |
97 | - return $this->cache->rememberForever(static::class . '@allThroughTagCategory:' . $positionTagCategory->id(), function() use ($positionTagCategory) { |
|
97 | + return $this->cache->rememberForever(static::class.'@allThroughTagCategory:'.$positionTagCategory->id(), function() use ($positionTagCategory) { |
|
98 | 98 | return $this->positionTagRepository->allThroughTagCategory($positionTagCategory); |
99 | 99 | }); |
100 | 100 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function getByReference(string $reference): GroupTagCategoryModel |
45 | 45 | { |
46 | - return $this->cache->rememberForever(static::class . '@getByReference:' . $reference, function() use ($reference) { |
|
46 | + return $this->cache->rememberForever(static::class.'@getByReference:'.$reference, function() use ($reference) { |
|
47 | 47 | return $this->groupTagCategoryRepository->getByReference($reference); |
48 | 48 | }); |
49 | 49 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function getById(int $id): GroupTagCategoryModel |
58 | 58 | { |
59 | - return $this->cache->rememberForever(static::class . '@getById:' . $id, function() use ($id) { |
|
59 | + return $this->cache->rememberForever(static::class.'@getById:'.$id, function() use ($id) { |
|
60 | 60 | return $this->groupTagCategoryRepository->getById($id); |
61 | 61 | }); |
62 | 62 | } |