changed avatar url in both old and new EDIT APIs| removed db raw from road items report| changed url in Randd

This commit is contained in:
2024-10-01 13:12:12 +00:00
parent bc4ae8d3a8
commit 7678ed9298
8 changed files with 17 additions and 14 deletions

View File

@@ -13,6 +13,7 @@ use App\Models\User;
use Carbon\Carbon;
use App\Models\City;
use App\Models\Province;
use Illuminate\Support\Facades\File;
use App\Models\EdarateShahri;
use App\Models\EdarateOstani;
use Cache;
@@ -2111,7 +2112,7 @@ class UserController extends Controller
$user->save();
if ($request->has('avatar')) {
Storage::delete('public/' . $user->avatar);
File::delete($user->avatar);
$destinationPath = 'avatar/' . $user->username;
$filename = time() .".". $request->file('avatar')->getClientOriginalExtension();
$request->file('avatar')->storeAs($destinationPath, $filename, 'public');