Skip to content

Commit

Permalink
Merge pull request #2 from fintechbd/LP-2-Registration
Browse files Browse the repository at this point in the history
LP-2 registration basic functions added
  • Loading branch information
hafijul233 authored Oct 1, 2023
2 parents 8542f44 + 65e1e5e commit 86554a1
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 39 deletions.
44 changes: 44 additions & 0 deletions config/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,50 @@
'login_id' => ['required', 'string'],
'password' => ['required', 'string', \Illuminate\Validation\Rules\Password::default()],
],
'register' => [
//user
'name' => ['required', 'string', 'min:2', 'max:255'],
'mobile' => ['required', 'string', 'min:10'],
'email' => ['required', 'string', 'email:rfc,dns', 'min:2', 'max:255'],
'login_id' => ['required', 'string', 'min:6', 'max:255'],
'password' => ['required', 'string', \Illuminate\Validation\Rules\Password::default()],
'pin' => ['required', 'string', 'min:4', 'max:16'],
'parent_id' => ['nullable', 'integer'],
'app_version' => ['nullable', 'string'],
'fcm_token' => ['nullable', 'string'],
'language' => ['nullable', 'string'],
'currency' => ['nullable', 'string'],

//profile
'father_name' => ['string', 'nullable'],
'mother_name' => ['string', 'nullable'],
'gender' => ['string', 'nullable'],
'marital_status' => ['string', 'nullable'],
'occupation' => ['string', 'nullable'],
'source_of_income' => ['string', 'nullable'],
'id_type' => ['string', 'nullable'],
'id_no' => ['string', 'nullable'],
'id_issue_country' => ['string', 'nullable'],
'id_expired_at' => ['string', 'nullable'],
'id_issue_at' => ['string', 'nullable'],
'profile_photo' => [\Illuminate\Validation\Rules\File::image(), 'nullable'],
'scan' => [\Illuminate\Validation\Rules\File::types(['application/pdf', 'image/*']), 'nullable'],
'scan_1' => [\Illuminate\Validation\Rules\File::types(['application/pdf', 'image/*']), 'nullable'],
'scan_2' => [\Illuminate\Validation\Rules\File::types(['application/pdf', 'image/*']), 'nullable'],
'date_of_birth' => ['date', 'nullable'],
'permanent_address' => ['string', 'nullable'],
'city_id' => ['integer', 'nullable'],
'state_id' => ['integer', 'nullable'],
'country_id' => ['integer', 'nullable'],
'post_code' => ['string', 'nullable'],
'present_address' => ['string', 'nullable'],
'present_city_id' => ['integer', 'nullable'],
'present_state_id' => ['integer', 'nullable'],
'present_country_id' => ['integer', 'nullable'],
'present_post_code' => ['string', 'nullable'],
'note' => ['string', 'nullable'],
'nationality' => ['string', 'nullable'],
],
],

/*
Expand Down
72 changes: 35 additions & 37 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,40 @@
|
*/

Route::prefix('v1')->group(function () {
Route::prefix('auth')->group(function () {
Route::post('/register', [RegisteredUserController::class, 'store'])
->middleware('guest')
->name('register');

Route::post('/login', [AuthenticatedSessionController::class, 'store'])
->middleware('guest')
->name('login');

Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
->middleware('guest')
->name('password.email');

Route::post('/reset-password', [NewPasswordController::class, 'store'])
->middleware('guest')
->name('password.store');

Route::get('/verify-email/{id}/{hash}', VerifyEmailController::class)
->middleware(['auth', 'signed', 'throttle:6,1'])
->name('verification.verify');

Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
->middleware(['auth', 'throttle:6,1'])
->name('verification.send');

Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
->middleware(config('fintech.auth.middleware'))
->name('logout');

Route::middleware(config('fintech.auth.middleware'))->group(function () {
Route::apiResource('users', \Fintech\Auth\Http\Controllers\UserController::class);
// Route::apiResource('roles', \Fintech\Auth\Http\Controllers\RoleController::class);
// Route::apiResource('permissions', \Fintech\Auth\Http\Resources\PermissionCollection::class);
// Route::apiResource('teams', \Fintech\Auth\Http\Controllers\TeamController::class);
Route::apiSingleton('users.profile', \Fintech\Auth\Http\Controllers\ProfileController::class);
});
Route::prefix('auth')->name('auth.')->group(function () {
Route::post('/register', [RegisteredUserController::class, 'store'])
->middleware('guest')
->name('register');

Route::post('/login', [AuthenticatedSessionController::class, 'store'])
->middleware('guest')
->name('login');

Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
->middleware('guest')
->name('password.email');

Route::post('/reset-password', [NewPasswordController::class, 'store'])
->middleware('guest')
->name('password.store');

Route::get('/verify-email/{id}/{hash}', VerifyEmailController::class)
->middleware(['auth', 'signed', 'throttle:6,1'])
->name('verification.verify');

Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
->middleware(['auth', 'throttle:6,1'])
->name('verification.send');

Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
->middleware(config('fintech.auth.middleware'))
->name('logout');

Route::middleware(config('fintech.auth.middleware'))->group(function () {
Route::apiResource('users', \Fintech\Auth\Http\Controllers\UserController::class);
// Route::apiResource('roles', \Fintech\Auth\Http\Controllers\RoleController::class);
// Route::apiResource('permissions', \Fintech\Auth\Http\Resources\PermissionCollection::class);
// Route::apiResource('teams', \Fintech\Auth\Http\Controllers\TeamController::class);
Route::apiSingleton('users.profile', \Fintech\Auth\Http\Controllers\ProfileController::class);
});
});
4 changes: 2 additions & 2 deletions src/Http/Requests/RegistrationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function authorize(): bool
*/
public function rules(): array
{
return [
return config('fintech.auth.validation.register', [
//user
'name' => ['required', 'string', 'min:2', 'max:255'],
'mobile' => ['required', 'string', 'min:10'],
Expand Down Expand Up @@ -66,6 +66,6 @@ public function rules(): array
'present_post_code' => ['string', 'nullable'],
'note' => ['string', 'nullable'],
'nationality' => ['string', 'nullable'],
];
]);
}
}

0 comments on commit 86554a1

Please sign in to comment.