authentication via username or phones

This commit is contained in:
2024-09-18 17:43:33 +05:00
parent e95797bb97
commit c086feb6c0
10 changed files with 78 additions and 25 deletions

View File

@@ -54,6 +54,9 @@ class ApiAuthController extends Controller
public function verify(AuthVerifyRequest $request): JsonResponse
{
$user = User::where('phone', $request->phone)->firstOrFail();
$user->update([
'phone_verified_at' => now(),
]);
return response()->json([
'message' => $user->createToken(bin2hex(random_bytes(20)))->plainTextToken,

View File

@@ -16,7 +16,7 @@ class LoanOrderController extends Controller
public function index(Request $request)
{
return response()->json(LoanOrderIndexResource::collection(
LoanOrder::query()->paginate()
LoanOrder::query()->where('user_id', auth()->id())->paginate()
));
}