Simplify redirects
This commit is contained in:
parent
0ede36c76d
commit
64a5104906
|
@ -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)
|
||||
{
|
||||
$contact->delete();
|
||||
|
||||
return Redirect::route('contacts.edit', $contact)->with('success', 'Contact deleted.');
|
||||
return Redirect::back()->with('success', 'Contact deleted.');
|
||||
}
|
||||
|
||||
public function restore(Contact $contact)
|
||||
{
|
||||
$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)
|
||||
{
|
||||
$organization->delete();
|
||||
|
||||
return Redirect::route('organizations.edit', $organization)->with('success', 'Organization deleted.');
|
||||
return Redirect::back()->with('success', 'Organization deleted.');
|
||||
}
|
||||
|
||||
public function restore(Organization $organization)
|
||||
{
|
||||
$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)
|
||||
{
|
||||
return Redirect::route('users.edit', $user)->with('error', 'Updating the demo user is not allowed.');
|
||||
if (App::environment('demo') && $user->isDemoUser()) {
|
||||
return Redirect::back()->with('error', 'Updating the demo user is not allowed.');
|
||||
}
|
||||
|
||||
Request::validate([
|
||||
|
@ -102,24 +102,24 @@ class UsersController extends Controller
|
|||
$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)
|
||||
{
|
||||
return Redirect::route('users.edit', $user)->with('error', 'Deleting the demo user is not allowed.');
|
||||
if (App::environment('demo') && $user->isDemoUser()) {
|
||||
return Redirect::back()->with('error', 'Deleting the demo user is not allowed.');
|
||||
}
|
||||
|
||||
$user->delete();
|
||||
|
||||
return Redirect::route('users.edit', $user)->with('success', 'User deleted.');
|
||||
return Redirect::back()->with('success', 'User deleted.');
|
||||
}
|
||||
|
||||
public function restore(User $user)
|
||||
{
|
||||
$user->restore();
|
||||
|
||||
return Redirect::route('users.edit', $user)->with('success', 'User restored.');
|
||||
return Redirect::back()->with('success', 'User restored.');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue