| Server IP : 138.197.107.151 / Your IP : 216.73.217.7 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/silversharkadmindev/app/Http/Controllers/ |
Upload File : |
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Http\Request;
class ProfileController extends Controller
{
public function edit()
{
return view('profile.edit', ['user' => Auth::user()]);
}
public function updateProfile(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'phone_full' => 'nullable|string|max:20',
]);
$user = Auth::user();
$user->update([
'name' => $request->name,
'phone' => $request->phone_full,
]);
return back()->with('success', 'Profile updated successfully.');
}
public function changePassword(Request $request)
{
$request->validate([
'old_password' => 'required',
'password' => 'required|confirmed|min:8',
],[
'password.confirmed' => 'Password and confirm password do not match.',
]);
$user = Auth::user();
if (!Hash::check($request->old_password, $user->password)) {
return back()->withErrors(['old_password' => 'Old password is incorrect']);
}
$user->update(['password' => Hash::make($request->password)]);
return back()->with('success', 'The password has been changed successfully.');
}
}