Simplify redirects
This commit is contained in:
parent
0ede36c76d
commit
64a5104906
3 changed files with 11 additions and 11 deletions
|
@ -111,20 +111,20 @@ class ContactsController extends Controller
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
return Redirect::route('contacts.edit', $contact)->with('success', 'Contact updated.');
|
return Redirect::back()->with('success', 'Contact updated.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(Contact $contact)
|
public function destroy(Contact $contact)
|
||||||
{
|
{
|
||||||
$contact->delete();
|
$contact->delete();
|
||||||
|
|
||||||
return Redirect::route('contacts.edit', $contact)->with('success', 'Contact deleted.');
|
return Redirect::back()->with('success', 'Contact deleted.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function restore(Contact $contact)
|
public function restore(Contact $contact)
|
||||||
{
|
{
|
||||||
$contact->restore();
|
$contact->restore();
|
||||||
|
|
||||||
return Redirect::route('contacts.edit', $contact)->with('success', 'Contact restored.');
|
return Redirect::back()->with('success', 'Contact restored.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,20 +79,20 @@ class OrganizationsController extends Controller
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
return Redirect::route('organizations.edit', $organization)->with('success', 'Organization updated.');
|
return Redirect::back()->with('success', 'Organization updated.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(Organization $organization)
|
public function destroy(Organization $organization)
|
||||||
{
|
{
|
||||||
$organization->delete();
|
$organization->delete();
|
||||||
|
|
||||||
return Redirect::route('organizations.edit', $organization)->with('success', 'Organization deleted.');
|
return Redirect::back()->with('success', 'Organization deleted.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function restore(Organization $organization)
|
public function restore(Organization $organization)
|
||||||
{
|
{
|
||||||
$organization->restore();
|
$organization->restore();
|
||||||
|
|
||||||
return Redirect::route('organizations.edit', $organization)->with('success', 'Organization restored.');
|
return Redirect::back()->with('success', 'Organization restored.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,8 @@ class UsersController extends Controller
|
||||||
|
|
||||||
public function update(User $user)
|
public function update(User $user)
|
||||||
{
|
{
|
||||||
return Redirect::route('users.edit', $user)->with('error', 'Updating the demo user is not allowed.');
|
|
||||||
if (App::environment('demo') && $user->isDemoUser()) {
|
if (App::environment('demo') && $user->isDemoUser()) {
|
||||||
|
return Redirect::back()->with('error', 'Updating the demo user is not allowed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
Request::validate([
|
Request::validate([
|
||||||
|
@ -102,24 +102,24 @@ class UsersController extends Controller
|
||||||
$user->update(['password' => Request::get('password')]);
|
$user->update(['password' => Request::get('password')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::route('users.edit', $user)->with('success', 'User updated.');
|
return Redirect::back()->with('success', 'User updated.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(User $user)
|
public function destroy(User $user)
|
||||||
{
|
{
|
||||||
return Redirect::route('users.edit', $user)->with('error', 'Deleting the demo user is not allowed.');
|
|
||||||
if (App::environment('demo') && $user->isDemoUser()) {
|
if (App::environment('demo') && $user->isDemoUser()) {
|
||||||
|
return Redirect::back()->with('error', 'Deleting the demo user is not allowed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->delete();
|
$user->delete();
|
||||||
|
|
||||||
return Redirect::route('users.edit', $user)->with('success', 'User deleted.');
|
return Redirect::back()->with('success', 'User deleted.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function restore(User $user)
|
public function restore(User $user)
|
||||||
{
|
{
|
||||||
$user->restore();
|
$user->restore();
|
||||||
|
|
||||||
return Redirect::route('users.edit', $user)->with('success', 'User restored.');
|
return Redirect::back()->with('success', 'User restored.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue