PATH:
home
/
lab2454c
/
credityorkgroup.com
/
app
/
Http
/
Controllers
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\Testimonial; use App\Models\Explore; use App\Models\FeaturedProduct; use App\Models\Service; class HomeController extends Controller { /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('auth')->except([ 'showHome' ]); } /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function dashboard() { return view('frontend.dashboard'); } public function showHome() { $data['testimonials'] = Testimonial::where('status', 'active')->orderBy('created_at', 'DESC')->get(); $data['explores'] = Explore::where('status', 'active')->orderBy('created_at', 'DESC')->get(); $data['services'] = Service::where('status', 'active')->orderBy('created_at', 'DESC')->get(); $data['products'] = FeaturedProduct::where('status', 'active')->orderBy('created_at', 'DESC')->take(3)->get(); return view('frontend.home', $data); } public function showProfile() { return view('frontend.profile'); } public function updateProfile(Request $request) { $user = auth()->user(); $changed=false; $values = $request->validate([ 'name' => ['required', 'string', 'max:100', 'min:3'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email,'. $user->id], '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'], ]); $user->fill($values); if ($user->isDirty()) { $user->save(); $changed = true; } if (! $changed) { $notify[] = ['warning', "No Changes Found"]; return redirect()->route('showProfile')->withNotify($notify); } $notify[] = ['success', "Record updated successfully!"]; return redirect()->route('showProfile')->withNotify($notify); } }
[+]
..
[-] Controller.php
[edit]
[+]
Admin
[+]
Auth
[-] SiteController.php
[edit]
[-] HomeController.php
[edit]