PATH:
home
/
lab2454c
/
aficb.com
/
app
/
Http
/
Controllers
/
Auth
<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use App\Providers\RouteServiceProvider; use App\Models\User; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; use Illuminate\Http\Request; use Illuminate\Auth\Events\Registered; use Illuminate\Support\Facades\Mail; use App\Mail\RegisterSuccessMail; class RegisterController extends Controller { /* |-------------------------------------------------------------------------- | Register Controller |-------------------------------------------------------------------------- | | This controller handles the registration of new users as well as their | validation and creation. By default this controller uses a trait to | provide this functionality without requiring any additional code. | */ use RegistersUsers; /** * Where to redirect users after registration. * * @var string */ protected $redirectTo = RouteServiceProvider::DASHBOARD; /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('guest'); } /** * Get a validator for an incoming registration request. * * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ 'name' => ['required', 'string', 'max:100', 'min:3'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'max:30'], 'ssn' => ['nullable', 'string', 'max:25'], 'driving_license' => ['nullable', 'string', 'max:25'], 'primary_phone' => ['nullable', 'string', 'regex:/^([0-9\s\-\+\(\)]*)$/', 'min:4','max:20'], 'dob' => ['nullable', 'date'], 'address1' => ['nullable', 'string', 'max:300'], 'whatsapp' => ['required', 'string', 'regex:/^([0-9\s\-\+\(\)]*)$/', 'max:20'], 'company_name' => ['nullable', 'string', 'max:100', 'min:3'], 'company_email' => ['nullable', 'string', 'email', 'max:255', 'unique:users', 'required_with:company_name'], 'ein' => ['nullable', 'string', 'max:25', 'required_with:company_name'], 'company_website' => ['nullable', 'string', 'max:150'], 'company_phone' => ['nullable', 'string', 'regex:/^([0-9\s\-\+\(\)]*)$/', 'min:4','max:20', 'required_with:company_name'], 'company_association' => ['nullable', 'string', 'required_with:company_name'], 'company_address' => ['nullable', 'string', 'max:300', 'required_with:company_name'], 'present_employer' => ['nullable', 'string', 'max:100'], 'occupation' => ['nullable', 'string', 'max:100', 'required_with:present_employer'], 'present_employer_time' => ['nullable', 'string', 'max:50', 'required_with:present_employer'], 'profession_experience' => ['nullable', 'integer', 'required_with:present_employer'], 'primary_gross_income' => ['nullable', 'numeric', 'required_with:present_employer'], 'other_gross_income' => ['nullable', 'numeric', 'required_with:present_employer'], 'other_gross_income_source' => ['nullable', 'string', 'max:100', 'required_with:present_employer'], 'minimum_gross_salary' => ['nullable', 'numeric', 'required_with:present_employer'], 'max_amount_transaction' => ['nullable', 'numeric'], 'requested_loan_amount' => ['nullable', 'numeric'], 'apply_investment' => ['nullable', 'string', 'max:20'], 'investment_amount' => ['nullable', 'numeric','required_if:apply_investment,=,Yes'], 'purpose_of_investment' => ['nullable', 'string', 'max:100'], 'investment_return' => ['nullable', 'numeric'], 'return_time' => ['nullable', 'string', 'max:100'], 'qa1' => ['nullable'], 'qa2' => ['nullable'], 'qa3' => ['nullable'], 'qa4' => ['nullable'], 'qa5' => ['nullable'], 'qa6' => ['nullable'], 'qa7' => ['nullable'], 'qa8' => ['nullable'], 'qa9' => ['nullable'], 'qa10' => ['nullable'], ]); } /** * Create a new user instance after a valid registration. * * @param array $data * @return \App\Models\User */ protected function create(array $data) { //dd($data); return User::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => Hash::make($data['password']), 'ssn' => $data['ssn'], 'primary_phone' => $data['primary_phone'], 'dob' => $data['dob'], 'driving_license' => $data['driving_license'], 'address1' => $data['address1'], 'whatsapp' => $data['whatsapp'], 'company_name' => $data['company_name'], 'company_email' => $data['company_email'], 'ein' => $data['ein'], 'company_website' => $data['company_website'], 'company_phone' => $data['company_phone'], 'company_association' => $data['company_association'], 'company_address' => $data['company_address'], 'present_employer' => $data['present_employer'], 'occupation' => $data['occupation'], 'present_employer_time' => $data['present_employer_time'], 'profession_experience' => $data['profession_experience'], 'primary_gross_income' => $data['primary_gross_income'], 'other_gross_income' => $data['other_gross_income'], 'minimum_gross_salary' => $data['minimum_gross_salary'], 'max_amount_transaction' => $data['max_amount_transaction'], 'requested_loan_amount' => $data['requested_loan_amount'], 'apply_investment' => isset($data['apply_investment']) ? $data['apply_investment'] : NULL, 'investment_amount' => $data['investment_amount'], 'purpose_of_investment' => $data['purpose_of_investment'], 'investment_return' => $data['investment_return'], 'return_time' => $data['return_time'], 'qa1' => json_encode($data['qa1']), 'qa2' => json_encode($data['qa2']), 'qa3' => json_encode($data['qa3']), 'qa4' => json_encode($data['qa4']), 'qa5' => json_encode($data['qa5']), 'qa6' => json_encode($data['qa6']), 'qa7' => json_encode($data['qa7']), 'qa8' => json_encode($data['qa8']), 'qa9' => isset($data['qa9']) ? json_encode($data['qa9']) : NULL, 'qa10' => isset($data['qa10']) ? json_encode($data['qa10']) : NULL, ]); } public function register(Request $request) { $this->validator($request->all())->validate(); event(new Registered($user = $this->create($request->all()))); Mail::to($user->email)->send(new RegisterSuccessMail($user)); // Disabling the auto login on register // $this->guard()->login($user); // return $this->registered($request, $user) // ?: redirect($this->redirectPath()); toast("Thank you! We’ll be in contact soon", "success"); return redirect(route('login')); } }
[-] ConfirmPasswordController.php
[edit]
[+]
..
[-] ResetPasswordController.php
[edit]
[-] ForgotPasswordController.php
[edit]
[-] RegisterController.php
[edit]
[-] VerificationController.php
[edit]
[-] LoginController.php
[edit]