diff --git a/app/Http/Controllers/Api/Auth/LoginController.php b/app/Http/Controllers/Api/Auth/LoginController.php index d16884aa..917df0b5 100755 --- a/app/Http/Controllers/Api/Auth/LoginController.php +++ b/app/Http/Controllers/Api/Auth/LoginController.php @@ -6,7 +6,6 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; class LoginController extends Controller { @@ -34,10 +33,8 @@ class LoginController extends Controller * description="Unauthorized or wrong credentials" * ) * ) - * - * @return \Illuminate\Http\JsonResponse */ - public function login(Request $request) + public function login(Request $request): \Illuminate\Http\JsonResponse { $request->validate([ 'email' => 'required|string|email', @@ -47,7 +44,7 @@ public function login(Request $request) $credentials = request(['email', 'password']); $token = auth('api')->attempt($credentials); - if (! $token) { + if (empty($token)) { return response()->json(['error' => 'Unauthorized'], 401); } @@ -56,20 +53,16 @@ public function login(Request $request) /** * Get the authenticated User. - * - * @return \Illuminate\Http\JsonResponse */ - public function me() + public function me(): \Illuminate\Http\JsonResponse { return response()->json(auth('api')->user()); } /** * Log the user out (Invalidate the token). - * - * @return \Illuminate\Http\JsonResponse */ - public function logout() + public function logout(): \Illuminate\Http\JsonResponse { auth('api')->logout(); @@ -78,25 +71,21 @@ public function logout() /** * Refresh a token. - * - * @return \Illuminate\Http\JsonResponse */ - public function refresh() + public function refresh(): \Illuminate\Http\JsonResponse { return $this->respondWithToken(auth('api')->refresh()); } /** * Get the token array structure. - * - * @return \Illuminate\Http\JsonResponse */ - protected function respondWithToken(string $token) + protected function respondWithToken(string $token): \Illuminate\Http\JsonResponse { return response()->json([ 'access_token' => $token, 'token_type' => 'bearer', - 'expires_in' => auth('api')->factory()->getTTL() * 60, + 'expires_in' => auth('api')->factory()->getTTL() * 120, ]); } } diff --git a/app/Http/Controllers/Api/Contact/ContactCreateController.php b/app/Http/Controllers/Api/Contact/ContactCreateController.php index a8a87c66..35a9442c 100755 --- a/app/Http/Controllers/Api/Contact/ContactCreateController.php +++ b/app/Http/Controllers/Api/Contact/ContactCreateController.php @@ -25,6 +25,17 @@ public function __construct(ContactRepository $contactRepository) * summary="Create a contact", * tags={"Contact"}, * security={{"bearerAuth": {} }}, + * @OA\RequestBody( + * required=true, + * description="Contact data", + * @OA\JsonContent( + * required={"contact_first_name", "lead_id", "contact_email", "contact_phone"}, + * @OA\Property(property="contact_first_name", type="string", maxLength=50, example="John"), + * @OA\Property(property="lead_id", type="integer", example=123), + * @OA\Property(property="contact_email", type="string", maxLength=254, format="email", example="john@example.com"), + * @OA\Property(property="contact_phone", type="string", maxLength=15, example="123-456-7890") + * ), + * ), * @OA\Response(response="400", description="Bad request: Please review required params"), * @OA\Response(response="201", description="Contact created successfully") * ) diff --git a/version.php b/version.php index 58e79851..4d8a6949 100755 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@