Skip to content

Commit dddd1d3

Browse files
committed
Merge branch '3.x' of github.com:BinarCode/laravel-restify into 3.x
2 parents 9423e4e + 5746794 commit dddd1d3

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

src/Http/Controllers/ProfileController.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Binaryk\LaravelRestify\Http\Requests\ProfileAvatarRequest;
66
use Binaryk\LaravelRestify\Http\Requests\RestifyRequest;
77
use Binaryk\LaravelRestify\Repositories\Repository;
8-
use Binaryk\LaravelRestify\Repositories\UserProfile;
98
use Binaryk\LaravelRestify\Services\Search\RepositorySearchService;
109

1110
class ProfileController extends RepositoryController
@@ -29,7 +28,7 @@ public function __invoke(RestifyRequest $request)
2928
$meta = [];
3029

3130
if (method_exists($user, 'profile')) {
32-
$meta = (array)call_user_func([$user, 'profile'], $request);
31+
$meta = (array) call_user_func([$user, 'profile'], $request);
3332
}
3433

3534
return $this->response()
@@ -41,12 +40,12 @@ public function guessRepository(RestifyRequest $request): ?Repository
4140
{
4241
$repository = $request->repository('users');
4342

44-
if (!$repository) {
43+
if (! $repository) {
4544
return null;
4645
}
4746

4847
if (method_exists($repository, 'canUseForProfile')) {
49-
if (!call_user_func([$repository, 'canUseForProfile'], $request)) {
48+
if (! call_user_func([$repository, 'canUseForProfile'], $request)) {
5049
return null;
5150
}
5251
}

src/Http/Controllers/ProfileUpdateController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function guessRepository(RestifyRequest $request): ?Repository
4242
}
4343

4444
if (method_exists($repository, 'canUseForProfileUpdate')) {
45-
if (!call_user_func([$repository, 'canUseForProfileUpdate'], $request)) {
45+
if (! call_user_func([$repository, 'canUseForProfileUpdate'], $request)) {
4646
return null;
4747
}
4848
}

src/Repositories/UserProfile.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public static function metaProfile(Request $request): array
3434
public function resolveShowMeta($request)
3535
{
3636
return [
37-
'authorizedToShow' => $this->authorizedToShow($request),
38-
'authorizedToStore' => $this->authorizedToStore($request),
39-
'authorizedToUpdate' => $this->authorizedToUpdate($request),
40-
'authorizedToDelete' => $this->authorizedToDelete($request),
41-
] + static::metaProfile($request);
37+
'authorizedToShow' => $this->authorizedToShow($request),
38+
'authorizedToStore' => $this->authorizedToStore($request),
39+
'authorizedToUpdate' => $this->authorizedToUpdate($request),
40+
'authorizedToDelete' => $this->authorizedToDelete($request),
41+
] + static::metaProfile($request);
4242
}
4343
}

tests/Controllers/ProfileControllerTest.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public function test_profile_returns_authenticated_user_with_related_posts()
4545
'data' => [
4646
'posts' => [
4747
[
48-
'title'
49-
]
50-
]
51-
]
48+
'title',
49+
],
50+
],
51+
],
5252
]);
5353
}
5454

@@ -140,7 +140,7 @@ public function test_get_profile_can_use_repository()
140140
->assertStatus(200)
141141
->assertJsonStructure([
142142
'attributes',
143-
'meta'
143+
'meta',
144144
]);
145145

146146
$response->assertJsonFragment([
@@ -159,10 +159,10 @@ public function test_profile_returns_authenticated_user_with_related_posts_via_r
159159
'relationships' => [
160160
'posts' => [
161161
[
162-
'attributes'
163-
]
164-
]
165-
]
162+
'attributes',
163+
],
164+
],
165+
],
166166
]);
167167

168168
$response->assertJsonFragment([
@@ -203,6 +203,4 @@ public function test_profile_update_via_repository()
203203
'name' => 'Eduard',
204204
]);
205205
}
206-
207-
208206
}

0 commit comments

Comments
 (0)