PATH:
home
/
lab2454c
/
westernclear.net
/
app
/
Http
/
Controllers
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\HomeBanner; use App\Models\LinkSection; use App\Models\GoldstarSection; use App\Models\UnmatchSection; use App\Models\UnmatchTextSection; use App\Models\InvestmentSection; use App\Models\InvestmentTextSection; use App\Models\OtherInvestmentSection; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; 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() { $data['user'] = Auth::user(); return view('frontend.dashboard', $data); } public function showHome() { $data['homeBanner'] = HomeBanner::where('status', 'active')->first(); $data['linkSections'] = LinkSection::orderBy('created_at')->get(); $data['goldstarSection'] = GoldstarSection::first(); $data['unmatchText'] = UnmatchTextSection::first(); $data['unmatchSections'] = UnmatchSection::all(); $data['investmentText'] = InvestmentTextSection::first(); $data['investmentSections'] = InvestmentSection::all(); $data['otherInvestmentSection'] = OtherInvestmentSection::first(); return view('frontend.home', $data); } public function showChangePassword() { return view('auth.changePassword'); } public function changePassword(Request $request) { $value = $request->validate([ 'current' => ['required', 'string', function ($attribute, $value, $fail) { if (!Hash::check($value, Auth::user()->password)) { return $fail(__('The current password is incorrect.')); } }], 'password' => 'required|string|confirmed|min:8|max:30|different:current', ]); if(Auth::guard()->attempt(['first_name'=>Auth::user()->first_name, 'password' => $value['current']])){ $user = Auth::user(); $user->password = Hash::make($value['password']); $user->save(); $notify[] = ['success', 'Your password has been successfully changed!']; return redirect()->route('dashboard')->withNotify($notify); } throw ValidationException::withMessages([ 'current' => [trans('auth.failed')], ]); } }
[+]
..
[-] Controller.php
[edit]
[-] ApplicationController.php
[edit]
[+]
Admin
[+]
Auth
[-] SiteController.php
[edit]
[-] HomeController.php
[edit]