WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 85eb776

Browse files
Change redirect route after edit -ALS
1 parent 7d226ff commit 85eb776

File tree

9 files changed

+45
-53
lines changed

9 files changed

+45
-53
lines changed

app/Http/Controllers/AdminController.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,6 @@ public function update(Request $request, $id)
161161
$input = $request->all();
162162
$user = Auth::user();
163163
$find_user = User::findOrFail($id);
164-
if ($find_user->gender->id == 1) {
165-
$word = 'administratora';
166-
} else {
167-
$word = 'administratorke';
168-
}
169164

170165
$photo_old = $request->photo;
171166

@@ -176,8 +171,9 @@ public function update(Request $request, $id)
176171
}
177172

178173
$user->whereId($id)->first()->update($input);
179-
180-
return to_route('edit-admin', $request->username)->with('admin-updated', "Uspješno ste izmijenili profil $word");
174+
FacadesSession::flash('admin-updated');
175+
176+
return to_route('all-admin');
181177
}
182178

183179
/**

app/Http/Controllers/LibrarianController.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,6 @@ public function update(Request $request, $id)
178178
$input = $request->all();
179179
$user = Auth::user();
180180
$find_user = User::findOrFail($id);
181-
if ($find_user->gender->id == 1) {
182-
$word = 'bibliotekara';
183-
} else {
184-
$word = 'bibliotekarke';
185-
}
186181

187182
$photo_old = $request->photo;
188183

@@ -193,8 +188,9 @@ public function update(Request $request, $id)
193188
}
194189

195190
$user->whereId($id)->first()->update($input);
196-
197-
return to_route('edit-librarian', $request->username)->with('librarian-updated', "Uspješno ste izmijenili profil $word");
191+
FacadesSession::flash('librarian-updated');
192+
193+
return to_route('all-librarian');
198194
}
199195

200196
/**

app/Http/Controllers/StudentController.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,6 @@ public function update(Request $request, $id)
178178
$input = $request->all();
179179
$user = Auth::user();
180180
$find_user = User::findOrFail($id);
181-
if ($find_user->gender->id == 1) {
182-
$word = 'učenika';
183-
} else {
184-
$word = 'učenice';
185-
}
186181

187182
$photo_old = $request->photo;
188183

@@ -193,8 +188,9 @@ public function update(Request $request, $id)
193188
}
194189

195190
$user->whereId($id)->first()->update($input);
196-
197-
return to_route('edit-student', $request->username)->with('student-updated', "Uspješno ste izmijenili profil $word");
191+
FacadesSession::flash('student-updated');
192+
193+
return to_route('all-student');
198194
}
199195

200196
/**

resources/views/pages/admins/admins.blade.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@
4444
</script>
4545
@endif
4646

47+
{{-- Administrator update flash message --}}
48+
@if (session()->has('admin-updated'))
49+
<script>
50+
swal({
51+
title: "Uspješno!",
52+
text: "Uspješno ste izmijenili profil administratora!",
53+
timer: 2500,
54+
type: "success",
55+
});
56+
</script>
57+
@endif
58+
4759
</h1>
4860
</div>
4961

resources/views/pages/admins/edit_admin.blade.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,6 @@
1717
<div class="pl-[30px] py-[10px] flex flex-col">
1818
<div>
1919
<h1>
20-
21-
{{-- Administrator update flash message --}}
22-
@if (session()->has('admin-updated'))
23-
<div id="hideDiv" class="flex p-2 mt-2 mb-1 text-sm text-green-700 bg-green-200 rounded-lg dark:bg-green-200 dark:text-green-800" role="alert">
24-
<svg aria-hidden="true" class="flex-shrink-0 inline w-5 h-5 mr-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path></svg>
25-
<span class="sr-only">Info</span>
26-
<div>
27-
<span class="font-medium">Uspješno!</span> {{session('admin-updated')}}
28-
</div>
29-
</div>
30-
@endif
3120
Izmijeni podatke
3221
</h1>
3322
</div>

resources/views/pages/librarians/edit_librarian.blade.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,6 @@
1717
<div class="pl-[30px] py-[10px] flex flex-col">
1818
<div>
1919
<h1>
20-
21-
{{-- Librarian update flash message --}}
22-
@if (session()->has('librarian-updated'))
23-
<div id="hideDiv" class="flex p-2 mt-2 mb-1 text-sm text-green-700 bg-green-200 rounded-lg dark:bg-green-200 dark:text-green-800" role="alert">
24-
<svg aria-hidden="true" class="flex-shrink-0 inline w-5 h-5 mr-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path></svg>
25-
<span class="sr-only">Info</span>
26-
<div>
27-
<span class="font-medium">Uspješno!</span> {{session('librarian-updated')}}
28-
</div>
29-
</div>
30-
@endif
3120
Izmijeni podatke
3221
</h1>
3322
</div>

resources/views/pages/librarians/librarians.blade.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040
type: "success",
4141
});
4242
</script>
43+
@endif
44+
45+
{{-- Librarian update flash message --}}
46+
@if (session()->has('librarian-updated'))
47+
<script>
48+
swal({
49+
title: "Uspješno!",
50+
text: "Uspješno ste izmijenili profil bibliotekara!",
51+
timer: 2500,
52+
type: "success",
53+
});
54+
</script>
4355
@endif
4456

4557
</h1>

resources/views/pages/students/edit_student.blade.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@
1616
<div class="pl-[30px] py-[10px] flex flex-col">
1717
<div>
1818
<h1>
19-
{{-- Student update flash message --}}
20-
@if (session()->has('student-updated'))
21-
<div id="hideDiv" class="flex p-2 mt-2 mb-1 text-sm text-green-700 bg-green-200 rounded-lg dark:bg-green-200 dark:text-green-800" role="alert">
22-
<svg aria-hidden="true" class="flex-shrink-0 inline w-5 h-5 mr-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path></svg>
23-
<span class="sr-only">Info</span>
24-
<div>
25-
<span class="font-medium">Uspješno!</span> {{session('student-updated')}}
26-
</div>
27-
</div>
28-
@endif
2919
Izmijeni podatke
3020
</h1>
3121
</div>

resources/views/pages/students/students.blade.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@
4343
type: "success",
4444
});
4545
</script>
46+
@endif
47+
48+
{{-- Student update flash message --}}
49+
@if (session()->has('student-updated'))
50+
<script>
51+
swal({
52+
title: "Uspješno!",
53+
text: "Uspješno ste izmijenili profil učenika!",
54+
timer: 2500,
55+
type: "success",
56+
});
57+
</script>
4658
@endif
4759

4860
</h1>

0 commit comments

Comments
 (0)