Skip to content

Commit

Permalink
Change redirect route after edit -ALS
Browse files Browse the repository at this point in the history
  • Loading branch information
perisicnikola37 committed Nov 11, 2022
1 parent 7d226ff commit 85eb776
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 53 deletions.
10 changes: 3 additions & 7 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ public function update(Request $request, $id)
$input = $request->all();
$user = Auth::user();
$find_user = User::findOrFail($id);
if ($find_user->gender->id == 1) {
$word = 'administratora';
} else {
$word = 'administratorke';
}

$photo_old = $request->photo;

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

$user->whereId($id)->first()->update($input);

return to_route('edit-admin', $request->username)->with('admin-updated', "Uspješno ste izmijenili profil $word");
FacadesSession::flash('admin-updated');

return to_route('all-admin');
}

/**
Expand Down
10 changes: 3 additions & 7 deletions app/Http/Controllers/LibrarianController.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ public function update(Request $request, $id)
$input = $request->all();
$user = Auth::user();
$find_user = User::findOrFail($id);
if ($find_user->gender->id == 1) {
$word = 'bibliotekara';
} else {
$word = 'bibliotekarke';
}

$photo_old = $request->photo;

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

$user->whereId($id)->first()->update($input);

return to_route('edit-librarian', $request->username)->with('librarian-updated', "Uspješno ste izmijenili profil $word");
FacadesSession::flash('librarian-updated');

return to_route('all-librarian');
}

/**
Expand Down
10 changes: 3 additions & 7 deletions app/Http/Controllers/StudentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ public function update(Request $request, $id)
$input = $request->all();
$user = Auth::user();
$find_user = User::findOrFail($id);
if ($find_user->gender->id == 1) {
$word = 'učenika';
} else {
$word = 'učenice';
}

$photo_old = $request->photo;

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

$user->whereId($id)->first()->update($input);

return to_route('edit-student', $request->username)->with('student-updated', "Uspješno ste izmijenili profil $word");
FacadesSession::flash('student-updated');

return to_route('all-student');
}

/**
Expand Down
12 changes: 12 additions & 0 deletions resources/views/pages/admins/admins.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@
</script>
@endif

{{-- Administrator update flash message --}}
@if (session()->has('admin-updated'))
<script>
swal({
title: "Uspješno!",
text: "Uspješno ste izmijenili profil administratora!",
timer: 2500,
type: "success",
});
</script>
@endif

</h1>
</div>

Expand Down
11 changes: 0 additions & 11 deletions resources/views/pages/admins/edit_admin.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
<div class="pl-[30px] py-[10px] flex flex-col">
<div>
<h1>

{{-- Administrator update flash message --}}
@if (session()->has('admin-updated'))
<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">
<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>
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Uspješno!</span> {{session('admin-updated')}}
</div>
</div>
@endif
Izmijeni podatke
</h1>
</div>
Expand Down
11 changes: 0 additions & 11 deletions resources/views/pages/librarians/edit_librarian.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
<div class="pl-[30px] py-[10px] flex flex-col">
<div>
<h1>

{{-- Librarian update flash message --}}
@if (session()->has('librarian-updated'))
<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">
<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>
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Uspješno!</span> {{session('librarian-updated')}}
</div>
</div>
@endif
Izmijeni podatke
</h1>
</div>
Expand Down
12 changes: 12 additions & 0 deletions resources/views/pages/librarians/librarians.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@
type: "success",
});
</script>
@endif

{{-- Librarian update flash message --}}
@if (session()->has('librarian-updated'))
<script>
swal({
title: "Uspješno!",
text: "Uspješno ste izmijenili profil bibliotekara!",
timer: 2500,
type: "success",
});
</script>
@endif

</h1>
Expand Down
10 changes: 0 additions & 10 deletions resources/views/pages/students/edit_student.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@
<div class="pl-[30px] py-[10px] flex flex-col">
<div>
<h1>
{{-- Student update flash message --}}
@if (session()->has('student-updated'))
<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">
<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>
<span class="sr-only">Info</span>
<div>
<span class="font-medium">Uspješno!</span> {{session('student-updated')}}
</div>
</div>
@endif
Izmijeni podatke
</h1>
</div>
Expand Down
12 changes: 12 additions & 0 deletions resources/views/pages/students/students.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@
type: "success",
});
</script>
@endif

{{-- Student update flash message --}}
@if (session()->has('student-updated'))
<script>
swal({
title: "Uspješno!",
text: "Uspješno ste izmijenili profil učenika!",
timer: 2500,
type: "success",
});
</script>
@endif

</h1>
Expand Down

0 comments on commit 85eb776

Please sign in to comment.