Use redirect()->route instead of ->to

This commit is contained in:
snipe 2016-12-15 20:02:47 -08:00
parent f832b15cf3
commit 4751bcd002
5 changed files with 44 additions and 44 deletions

View file

@ -267,7 +267,7 @@ class AccessoriesController extends Controller
// Check if the accessory exists
if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the accessory management page with error
return redirect()->to('accessories')->with('error', trans('admin/accessories/message.not_found'));
return redirect()->to('accessories.index')->with('error', trans('admin/accessories/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
return redirect()->route('accessories.index')->with('error', trans('general.insufficient_permissions'));
}
@ -294,7 +294,7 @@ class AccessoriesController extends Controller
// Check if the accessory exists
if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the accessory management page with error
return redirect()->to('accessories')->with('error', trans('admin/accessories/message.user_not_found'));
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.user_not_found'));
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
return redirect()->route('accessories.index')->with('error', trans('general.insufficient_permissions'));
}

View file

@ -93,7 +93,7 @@ class AssetsController extends Controller
if ($asset = Asset::where('asset_tag', '=', Input::get('assetTag'))->first()) {
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch);
}
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
}
@ -292,9 +292,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (!$item = Asset::find($assetId)) {
// Redirect to the asset management page
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($item)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
// Grab the dropdown lists
@ -336,9 +336,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (!$asset = Asset::find($assetId)) {
// Redirect to the asset management page with error
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
if ($request->has('status_id')) {
@ -476,9 +476,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
DB::table('assets')
@ -489,7 +489,7 @@ class AssetsController extends Controller
$asset->delete();
// Redirect to the asset management page
return redirect()->to('hardware')->with('success', trans('admin/hardware/message.delete.success'));
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.delete.success'));
@ -510,9 +510,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find(e($assetId)))) {
// Redirect to the asset management page with error
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
// Get the dropdown of users and then pass it to the checkout view
@ -535,11 +535,11 @@ class AssetsController extends Controller
// Check if the asset exists
if (!$asset = Asset::find($assetId)) {
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
} elseif (!$asset->availableForCheckout()) {
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.checkout.not_available'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.checkout.not_available'));
}
$user = User::find(e(Input::get('assigned_to')));
@ -582,9 +582,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
$statusLabel_list = Helper::statusLabelList();
return View::make('hardware/checkin', compact('asset'))->with('statusLabel_list', $statusLabel_list)->with('backto', $backto);
@ -604,9 +604,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
$admin = Auth::user();
@ -614,7 +614,7 @@ class AssetsController extends Controller
if (!is_null($asset->assigned_to)) {
$user = User::find($asset->assigned_to);
} else {
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.checkin.already_checked_in'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.checkin.already_checked_in'));
}
// This is just used for the redirect
@ -718,7 +718,7 @@ class AssetsController extends Controller
$settings = Setting::getSettings();
if (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
} elseif ($asset->userloc) {
$use_currency = $asset->userloc->currency;
} elseif ($asset->assetloc) {
@ -835,7 +835,7 @@ class AssetsController extends Controller
$files = array();
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
// Check if the uploads directory exists. If not, try to create it.
@ -876,7 +876,7 @@ class AssetsController extends Controller
{
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
} elseif (!config('app.lock_passwords')) {
@ -931,7 +931,7 @@ class AssetsController extends Controller
public function getDeleteImportFile($filename)
{
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
if (unlink(config('app.private_uploads').'/imports/assets/'.$filename)) {
@ -957,7 +957,7 @@ class AssetsController extends Controller
$updateItems = Input::get('import-update');
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
$importOptions = ['filename'=> config('app.private_uploads').'/imports/assets/'.$filename,
'--email_format'=>'firstname.lastname',
@ -1010,9 +1010,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset_to_clone = Asset::find($assetId))) {
// Redirect to the asset management page
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset_to_clone)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
// Grab the dropdown lists
@ -1234,7 +1234,7 @@ class AssetsController extends Controller
$asset = Asset::withTrashed()->find($assetId);
if (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
} elseif (isset($asset->id)) {
// Restore the asset
@ -1242,7 +1242,7 @@ class AssetsController extends Controller
return redirect()->route('hardware')->with('success', trans('admin/hardware/message.restore.success'));
} else {
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
}
}
@ -1268,7 +1268,7 @@ class AssetsController extends Controller
if (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
if (Input::hasFile('assetfile')) {
@ -1316,7 +1316,7 @@ class AssetsController extends Controller
if (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
$log = Actionlog::find($fileId);
@ -1357,7 +1357,7 @@ class AssetsController extends Controller
if (!Company::isCurrentUserHasAccess($asset)) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
}
$log = Actionlog::find($fileId);
@ -1396,7 +1396,7 @@ class AssetsController extends Controller
{
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
} elseif (!Input::has('edit_asset')) {
return redirect()->back()->with('error', 'No assets selected');
@ -1475,7 +1475,7 @@ class AssetsController extends Controller
{
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
} elseif (Input::has('bulk_edit')) {
@ -1579,7 +1579,7 @@ class AssetsController extends Controller
{
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('hardware.index')->with('error', trans('general.insufficient_permissions'));
} elseif (Input::has('bulk_edit')) {
//$assets = Input::get('bulk_edit');
$assets = Asset::find(Input::get('bulk_edit'));

View file

@ -277,7 +277,7 @@ class ComponentsController extends Controller
// Check if the component exists
if (is_null($component = Component::find($componentId))) {
// Redirect to the component management page with error
return redirect()->to('components')->with('error', trans('admin/components/message.not_found'));
return redirect()->route('components.index')->with('error', trans('admin/components/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($component)) {
return redirect()->route('components.index')->with('error', trans('general.insufficient_permissions'));
}
@ -306,7 +306,7 @@ class ComponentsController extends Controller
// Check if the component exists
if (is_null($component = Component::find($componentId))) {
// Redirect to the component management page with error
return redirect()->to('components')->with('error', trans('admin/components/message.not_found'));
return redirect()->route('components.index')->with('error', trans('admin/components/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($component)) {
return redirect()->route('components.index')->with('error', trans('general.insufficient_permissions'));
}

View file

@ -269,7 +269,7 @@ class ConsumablesController extends Controller
// Check if the consumable exists
if (is_null($consumable = Consumable::find($consumableId))) {
// Redirect to the consumable management page with error
return redirect()->to('consumables')->with('error', trans('admin/consumables/message.not_found'));
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
return redirect()->route('consumables.index')->with('error', trans('general.insufficient_permissions'));
}
@ -295,7 +295,7 @@ class ConsumablesController extends Controller
// Check if the consumable exists
if (is_null($consumable = Consumable::find($consumableId))) {
// Redirect to the consumable management page with error
return redirect()->to('consumables')->with('error', trans('admin/consumables/message.not_found'));
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
return redirect()->route('consumables.index')->with('error', trans('general.insufficient_permissions'));
}

View file

@ -1,7 +1,7 @@
<?php
return array (
'app_version' => 'v3.6.2',
'build_version' => '18',
'hash_version' => 'g6f1e0d6',
'full_hash' => 'v3.6.2-18-g6f1e0d6',
);
'app_version' => 'v3.6.1',
'build_version' => 'pre',
'hash_version' => '90',
'full_hash' => 'v3.6.1-pre-90-ge685e0f',
);