fixed the issue saving instructor image on user table
Cette révision appartient à :
Parent
8a0b763e36
révision
b3283c317a
@ -56,8 +56,9 @@ public function store(AddNewRequest $request)
|
||||
$instructor->language = 'en';
|
||||
$instructor->access_block = $request->access_block;
|
||||
if ($request->hasFile('image')) {
|
||||
$imageName = rand(111, 999) . time() . '.' . $request->image->extension();
|
||||
$request->image->move(public_path('uploads/instructors'), $imageName);
|
||||
$roleName = Role::find($request->role_id)?->name;
|
||||
$imageName = $roleName.'-'.$request->name_en.'.'. $request->image->extension();
|
||||
$request->image->move(public_path('uploads/users'), $imageName);
|
||||
$instructor->image = $imageName;
|
||||
}
|
||||
if ($instructor->save()) {
|
||||
@ -69,6 +70,9 @@ public function store(AddNewRequest $request)
|
||||
$user->role_id = $request->roleId;
|
||||
$user->status = $request->status;
|
||||
$user->password = Hash::make($request->password);
|
||||
if (isset($imageName)) {
|
||||
$user->image = $imageName; // Save the image name in the users table
|
||||
}
|
||||
if ($user->save()) {
|
||||
DB::commit();
|
||||
$this->notice::success('Successfully saved');
|
||||
@ -129,8 +133,9 @@ public function update(UpdateRequest $request, $id)
|
||||
$instructor->access_block = $request->access_block;
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
$imageName = rand(111, 999) . time() . '.' . $request->image->extension();
|
||||
$request->image->move(public_path('uploads/instructors'), $imageName);
|
||||
$roleName = Role::find($request->role_id)?->name;
|
||||
$imageName = $roleName . '-' . $request->name_en . '.' . $request->image->extension();
|
||||
$request->image->move(public_path('uploads/users'), $imageName);
|
||||
$instructor->image = $imageName;
|
||||
}
|
||||
if ($instructor->save()) {
|
||||
@ -142,6 +147,9 @@ public function update(UpdateRequest $request, $id)
|
||||
$user->role_id = $request->roleId;
|
||||
$user->status = $request->status;
|
||||
$user->password = Hash::make($request->password);
|
||||
if (isset($imageName)) {
|
||||
$user->image = $imageName; // Save the image name in the users table
|
||||
}
|
||||
if ($user->save()) {
|
||||
DB::commit();
|
||||
$this->notice::success('Successfully saved');
|
||||
|
||||
BIN
public/uploads/instructors/1971708533737.png
Fichier normal
BIN
public/uploads/instructors/1971708533737.png
Fichier normal
Fichier binaire non affiché.
|
Après Largeur: | Hauteur: | Taille: 107 KiB |
BIN
public/uploads/instructors/3321708533352.png
Fichier normal
BIN
public/uploads/instructors/3321708533352.png
Fichier normal
Fichier binaire non affiché.
|
Après Largeur: | Hauteur: | Taille: 67 KiB |
BIN
public/uploads/instructors/3931708534567.png
Fichier normal
BIN
public/uploads/instructors/3931708534567.png
Fichier normal
Fichier binaire non affiché.
|
Après Largeur: | Hauteur: | Taille: 67 KiB |
BIN
public/uploads/instructors/7681708533867.jpg
Fichier normal
BIN
public/uploads/instructors/7681708533867.jpg
Fichier normal
Fichier binaire non affiché.
|
Après Largeur: | Hauteur: | Taille: 169 KiB |
BIN
public/uploads/instructors/9121708534063.png
Fichier normal
BIN
public/uploads/instructors/9121708534063.png
Fichier normal
Fichier binaire non affiché.
|
Après Largeur: | Hauteur: | Taille: 67 KiB |
@ -63,7 +63,7 @@ class="nav-link btn-primary mr-1 show active">List View</a></li>
|
||||
<tr>
|
||||
<td>
|
||||
<img class="rounded-circle" width="35" height="35"
|
||||
src="{{asset('public/uploads/instructors/'.$d->image)}}" alt="">
|
||||
src="{{asset('public/uploads/users/'.$d->image)}}" alt="">
|
||||
</td>
|
||||
<td><strong>{{$d->name_en}}</strong></td>
|
||||
<td>{{$d->email}}</td>
|
||||
|
||||
Chargement…
Référencer dans un nouveau ticket
Block a user