Skip to content

Commit 2397bc6

Browse files
committed
Merge branch 'main' of github.com:robuedi/properties-api
2 parents 37183df + cdfd3e2 commit 2397bc6

10 files changed

+28
-31
lines changed

app/Http/Controllers/Api/v1/PropertyController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class PropertyController extends Controller
1616
{
1717
/**
1818
* List properties
19-
*
19+
*
2020
* @unauthenticated
2121
*/
2222
public function index(GenericListingRequest $request)
@@ -108,7 +108,7 @@ public function store(StorePropertyRequest $request)
108108

109109
/**
110110
* Show a property
111-
*
111+
*
112112
* @unauthenticated
113113
*/
114114
public function show(Request $request, int $property)

app/Http/Controllers/Auth/AuthController.php

+11-13
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use App\Http\Controllers\Controller;
66
use App\Http\Requests\Auth\LoginRequest;
7-
use Illuminate\Http\Request;
87
use Illuminate\Http\JsonResponse;
8+
use Illuminate\Http\Request;
99
use Illuminate\Http\Response;
1010
use Illuminate\Support\Facades\Auth;
1111

@@ -25,8 +25,8 @@ public function __construct()
2525
}
2626

2727
/**
28-
* Login
29-
*
28+
* Login
29+
*
3030
* Get a JWT via given credentials.
3131
*/
3232
public function login(LoginRequest $request): JsonResponse
@@ -42,18 +42,17 @@ public function login(LoginRequest $request): JsonResponse
4242

4343
/**
4444
* Authenticated user data
45-
*
45+
*
4646
* Get the authenticated User.
4747
*/
48-
public function me() : JsonResponse
48+
public function me(): JsonResponse
4949
{
5050
return response()->json(auth()->user());
5151
}
5252

53-
5453
/**
55-
* Logout
56-
*
54+
* Logout
55+
*
5756
* Log the user out (Invalidate the token).
5857
*/
5958
public function logout(Request $request): Response
@@ -65,27 +64,26 @@ public function logout(Request $request): Response
6564

6665
/**
6766
* Token refresh
68-
*
67+
*
6968
* Refresh a token.
7069
*/
71-
public function refresh() : JsonResponse
70+
public function refresh(): JsonResponse
7271
{
7372
return $this->respondWithToken(auth()->refresh(true, true));
7473
}
7574

7675
/**
7776
* Get the token array structure.
7877
*
79-
* @param string $token
80-
*
78+
* @param string $token
8179
* @return \Illuminate\Http\JsonResponse
8280
*/
8381
protected function respondWithToken($token)
8482
{
8583
return response()->json([
8684
'access_token' => $token,
8785
'token_type' => 'bearer',
88-
'expires_in' => auth()->factory()->getTTL() * 60
86+
'expires_in' => auth()->factory()->getTTL() * 60,
8987
]);
9088
}
9189
}

app/Http/Controllers/Auth/EmailVerificationNotificationController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class EmailVerificationNotificationController extends Controller
1414
{
1515
/**
1616
* Email verification link
17-
*
17+
*
1818
* Send a new email verification notification.
1919
*/
2020
public function store(Request $request): JsonResponse|RedirectResponse

app/Http/Controllers/Auth/NewPasswordController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class NewPasswordController extends Controller
1919
{
2020
/**
2121
* Password change
22-
*
22+
*
2323
* Handle an incoming new password request.
2424
*
2525
* @throws \Illuminate\Validation\ValidationException

app/Http/Controllers/Auth/PasswordResetLinkController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PasswordResetLinkController extends Controller
1515
{
1616
/**
1717
* Password reset link
18-
*
18+
*
1919
* Handle an incoming password reset link request.
2020
*
2121
* @throws \Illuminate\Validation\ValidationException

app/Http/Controllers/Auth/RegisteredUserController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RegisteredUserController extends Controller
1818
{
1919
/**
2020
* Register
21-
*
21+
*
2222
* Handle an incoming registration request.
2323
*
2424
* @throws \Illuminate\Validation\ValidationException

app/Providers/AppServiceProvider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace App\Providers;
44

5-
use Illuminate\Auth\Notifications\ResetPassword;
6-
use Illuminate\Support\ServiceProvider;
75
use Dedoc\Scramble\Scramble;
86
use Dedoc\Scramble\Support\Generator\OpenApi;
97
use Dedoc\Scramble\Support\Generator\SecurityScheme;
8+
use Illuminate\Auth\Notifications\ResetPassword;
9+
use Illuminate\Support\ServiceProvider;
1010

1111
class AppServiceProvider extends ServiceProvider
1212
{

routes/auth.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22

33
use App\Http\Controllers\Auth\AuthController;
4-
use App\Http\Controllers\Auth\AuthenticatedUserController;
54
use App\Http\Controllers\Auth\EmailVerificationNotificationController;
65
use App\Http\Controllers\Auth\NewPasswordController;
76
use App\Http\Controllers\Auth\PasswordResetLinkController;

tests/Feature/Auth/AuthenticatedUserTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
'password' => 'password',
1212
]);
1313

14-
$response = $this->withHeader('Authorization', 'Bearer ' . $response_->json('authorization.token'))
15-
->getJson(route('auth.me'));
14+
$response = $this->withHeader('Authorization', 'Bearer '.$response_->json('authorization.token'))
15+
->getJson(route('auth.me'));
1616

1717
$response
1818
->assertStatus(Response::HTTP_OK)
@@ -36,11 +36,11 @@
3636
]);
3737

3838
$oldToken = $response1->json('access_token');
39-
$response2 = $this->withHeader('Authorization', 'Bearer ' . $oldToken)
39+
$response2 = $this->withHeader('Authorization', 'Bearer '.$oldToken)
4040
->postJson(route('auth.refresh'));
4141

4242
$response2->assertStatus(Response::HTTP_OK)
43-
->assertJsonStructure(['access_token', 'token_type', 'expires_in']);
43+
->assertJsonStructure(['access_token', 'token_type', 'expires_in']);
4444

4545
expect($oldToken)->not->toBe($response2->json('access_token'));
4646
});

tests/Feature/Auth/AuthenticationTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
'password' => 'password',
3737
]);
3838

39-
$response2 = $this->withHeader('Authorization', 'Bearer ' . $response1->json('authorization.token'))
40-
->getJson(route('auth.me'));
39+
$response2 = $this->withHeader('Authorization', 'Bearer '.$response1->json('authorization.token'))
40+
->getJson(route('auth.me'));
4141

4242
$response2
4343
->assertStatus(Response::HTTP_OK);
4444

45-
$response3 = $this->withHeader('Authorization', 'Bearer ' . $response1->json('authorization.token'))->post(route('auth.logout'));
45+
$response3 = $this->withHeader('Authorization', 'Bearer '.$response1->json('authorization.token'))->post(route('auth.logout'));
4646

47-
$response4 = $this->withHeader('Authorization', 'Bearer ' . $response1->json('authorization.token'))
48-
->getJson(route('auth.me'));
47+
$response4 = $this->withHeader('Authorization', 'Bearer '.$response1->json('authorization.token'))
48+
->getJson(route('auth.me'));
4949

5050
$response4
5151
->assertUnauthorized();

0 commit comments

Comments
 (0)