Use updated redirect() reference
This commit is contained in:
@@ -100,11 +100,11 @@ class AccessoriesController extends Controller
|
||||
// Was the accessory created?
|
||||
if ($accessory->save()) {
|
||||
// Redirect to the new accessory page
|
||||
return Redirect::to("admin/accessories")->with('success', trans('admin/accessories/message.create.success'));
|
||||
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.create.success'));
|
||||
}
|
||||
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($accessory->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($accessory->getErrors());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,9 +119,9 @@ class AccessoriesController extends Controller
|
||||
// Check if the accessory exists
|
||||
if (is_null($accessory = Accessory::find($accessoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type', '=', 'accessory')->whereNull('deleted_at')->orderBy('name', 'ASC')->lists('name', 'id');
|
||||
@@ -147,9 +147,9 @@ class AccessoriesController extends Controller
|
||||
// Check if the blog post exists
|
||||
if (is_null($accessory = Accessory::find($accessoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Update the accessory data
|
||||
@@ -182,11 +182,11 @@ class AccessoriesController extends Controller
|
||||
// Was the accessory created?
|
||||
if ($accessory->save()) {
|
||||
// Redirect to the new accessory page
|
||||
return Redirect::to("admin/accessories")->with('success', trans('admin/accessories/message.update.success'));
|
||||
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.update.success'));
|
||||
}
|
||||
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($accessory->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($accessory->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -202,19 +202,19 @@ class AccessoriesController extends Controller
|
||||
// Check if the blog post exists
|
||||
if (is_null($accessory = Accessory::find($accessoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
|
||||
if ($accessory->hasUsers() > 0) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.assoc_users', array('count'=> $accessory->hasUsers())));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.assoc_users', array('count'=> $accessory->hasUsers())));
|
||||
} else {
|
||||
$accessory->delete();
|
||||
|
||||
// Redirect to the locations management page
|
||||
return Redirect::to('admin/accessories')->with('success', trans('admin/accessories/message.delete.success'));
|
||||
return redirect()->to('admin/accessories')->with('success', trans('admin/accessories/message.delete.success'));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ class AccessoriesController extends Controller
|
||||
if (isset($accessory->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('accessories/view', compact('accessory'));
|
||||
}
|
||||
@@ -247,7 +247,7 @@ class AccessoriesController extends Controller
|
||||
$error = trans('admin/accessories/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('accessories')->with('error', $error);
|
||||
return redirect()->route('accessories')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
@@ -265,9 +265,9 @@ 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')->with('error', trans('admin/accessories/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
@@ -292,13 +292,13 @@ 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()->to('accessories')->with('error', trans('admin/accessories/message.user_not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (!$user = User::find(Input::get('assigned_to'))) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
|
||||
}
|
||||
|
||||
// Update the accessory data
|
||||
@@ -379,7 +379,7 @@ class AccessoriesController extends Controller
|
||||
}
|
||||
|
||||
// Redirect to the new accessory page
|
||||
return Redirect::to("admin/accessories")->with('success', trans('admin/accessories/message.checkout.success'));
|
||||
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.checkout.success'));
|
||||
|
||||
|
||||
|
||||
@@ -398,13 +398,13 @@ class AccessoriesController extends Controller
|
||||
// Check if the accessory exists
|
||||
if (is_null($accessory_user = DB::table('accessories_users')->find($accessoryUserId))) {
|
||||
// Redirect to the accessory management page with error
|
||||
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
|
||||
}
|
||||
|
||||
$accessory = Accessory::find($accessory_user->accessory_id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('accessories/checkin', compact('accessory'))->with('backto', $backto);
|
||||
}
|
||||
@@ -424,14 +424,14 @@ class AccessoriesController extends Controller
|
||||
// Check if the accessory exists
|
||||
if (is_null($accessory_user = DB::table('accessories_users')->find($accessoryUserId))) {
|
||||
// Redirect to the accessory management page with error
|
||||
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
|
||||
}
|
||||
|
||||
|
||||
$accessory = Accessory::find($accessory_user->accessory_id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$logaction = new Actionlog();
|
||||
@@ -507,14 +507,14 @@ class AccessoriesController extends Controller
|
||||
}
|
||||
|
||||
if ($backto=='user') {
|
||||
return Redirect::to("admin/users/".$return_to.'/view')->with('success', trans('admin/accessories/message.checkin.success'));
|
||||
return redirect()->to("admin/users/".$return_to.'/view')->with('success', trans('admin/accessories/message.checkin.success'));
|
||||
} else {
|
||||
return Redirect::to("admin/accessories/".$accessory->id."/view")->with('success', trans('admin/accessories/message.checkin.success'));
|
||||
return redirect()->to("admin/accessories/".$accessory->id."/view")->with('success', trans('admin/accessories/message.checkin.success'));
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to the accessory management page with error
|
||||
return Redirect::to("admin/accessories")->with('error', trans('admin/accessories/message.checkin.error'));
|
||||
return redirect()->to("admin/accessories")->with('error', trans('admin/accessories/message.checkin.error'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -272,7 +272,7 @@ class AssetMaintenancesController extends Controller
|
||||
if ($assetMaintenance->save()) {
|
||||
|
||||
// Redirect to the new asset maintenance page
|
||||
return Redirect::to("admin/asset_maintenances")
|
||||
return redirect()->to("admin/asset_maintenances")
|
||||
->with('success', trans('admin/asset_maintenances/message.create.success'));
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ class AssetMaintenancesController extends Controller
|
||||
// Check if the asset maintenance exists
|
||||
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
|
||||
// Redirect to the improvement management page
|
||||
return Redirect::to('admin/asset_maintenances')
|
||||
return redirect()->to('admin/asset_maintenances')
|
||||
->with('error', trans('admin/asset_maintenances/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
@@ -381,7 +381,7 @@ class AssetMaintenancesController extends Controller
|
||||
// Check if the asset maintenance exists
|
||||
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
|
||||
// Redirect to the asset maintenance management page
|
||||
return Redirect::to('admin/asset_maintenances')
|
||||
return redirect()->to('admin/asset_maintenances')
|
||||
->with('error', trans('admin/asset_maintenances/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
@@ -451,10 +451,10 @@ class AssetMaintenancesController extends Controller
|
||||
if ($assetMaintenance->save()) {
|
||||
|
||||
// Redirect to the new asset maintenance page
|
||||
return Redirect::to("admin/asset_maintenances")
|
||||
return redirect()->to("admin/asset_maintenances")
|
||||
->with('success', trans('admin/asset_maintenances/message.create.success'));
|
||||
}
|
||||
return Redirect::back() ->withInput()->withErrors($assetMaintenance->getErrors());
|
||||
return redirect()->back() ->withInput()->withErrors($assetMaintenance->getErrors());
|
||||
|
||||
|
||||
}
|
||||
@@ -473,7 +473,7 @@ class AssetMaintenancesController extends Controller
|
||||
// Check if the asset maintenance exists
|
||||
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
|
||||
// Redirect to the asset maintenance management page
|
||||
return Redirect::to('admin/asset_maintenances')
|
||||
return redirect()->to('admin/asset_maintenances')
|
||||
->with('error', trans('admin/asset_maintenances/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
@@ -483,7 +483,7 @@ class AssetMaintenancesController extends Controller
|
||||
$assetMaintenance->delete();
|
||||
|
||||
// Redirect to the asset_maintenance management page
|
||||
return Redirect::to('admin/asset_maintenances')
|
||||
return redirect()->to('admin/asset_maintenances')
|
||||
->with('success', trans('admin/asset_maintenances/message.delete.success'));
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ class AssetMaintenancesController extends Controller
|
||||
// Check if the asset maintenance exists
|
||||
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
|
||||
// Redirect to the asset maintenance management page
|
||||
return Redirect::to('admin/asset_maintenances')
|
||||
return redirect()->to('admin/asset_maintenances')
|
||||
->with('error', trans('admin/asset_maintenances/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
|
||||
@@ -120,10 +120,10 @@ class AssetModelsController extends Controller
|
||||
// Was it created?
|
||||
if ($model->save()) {
|
||||
// Redirect to the new model page
|
||||
return Redirect::to("hardware/models")->with('success', trans('admin/models/message.create.success'));
|
||||
return redirect()->to("hardware/models")->with('success', trans('admin/models/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($model->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($model->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ class AssetModelsController extends Controller
|
||||
// Check if the model exists
|
||||
if (is_null($model = AssetModel::find($modelId))) {
|
||||
// Redirect to the model management page
|
||||
return Redirect::to('assets/models')->with('error', trans('admin/models/message.does_not_exist'));
|
||||
return redirect()->to('assets/models')->with('error', trans('admin/models/message.does_not_exist'));
|
||||
}
|
||||
|
||||
$depreciation_list = \App\Helpers\Helper::depreciationList();
|
||||
@@ -206,7 +206,7 @@ class AssetModelsController extends Controller
|
||||
// Check if the model exists
|
||||
if (is_null($model = AssetModel::find($modelId))) {
|
||||
// Redirect to the models management page
|
||||
return Redirect::to('admin/models')->with('error', trans('admin/models/message.does_not_exist'));
|
||||
return redirect()->to('admin/models')->with('error', trans('admin/models/message.does_not_exist'));
|
||||
}
|
||||
|
||||
|
||||
@@ -252,14 +252,14 @@ class AssetModelsController extends Controller
|
||||
// Was it created?
|
||||
if ($model->save()) {
|
||||
// Redirect to the new model page
|
||||
return Redirect::to("hardware/models")->with('success', trans('admin/models/message.update.success'));
|
||||
return redirect()->to("hardware/models")->with('success', trans('admin/models/message.update.success'));
|
||||
} else {
|
||||
return redirect()->back()->withInput()->withErrors($model->getErrors());
|
||||
}
|
||||
|
||||
|
||||
// Redirect to the model create page
|
||||
return Redirect::to("hardware/models/$modelId/edit")->with('error', trans('admin/models/message.update.error'));
|
||||
return redirect()->to("hardware/models/$modelId/edit")->with('error', trans('admin/models/message.update.error'));
|
||||
|
||||
}
|
||||
|
||||
@@ -277,19 +277,19 @@ class AssetModelsController extends Controller
|
||||
// Check if the model exists
|
||||
if (is_null($model = AssetModel::find($modelId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('hardware/models')->with('error', trans('admin/models/message.not_found'));
|
||||
return redirect()->to('hardware/models')->with('error', trans('admin/models/message.not_found'));
|
||||
}
|
||||
|
||||
if ($model->assets->count() > 0) {
|
||||
// Throw an error that this model is associated with assets
|
||||
return Redirect::to('hardware/models')->with('error', trans('admin/models/message.assoc_users'));
|
||||
return redirect()->to('hardware/models')->with('error', trans('admin/models/message.assoc_users'));
|
||||
|
||||
} else {
|
||||
// Delete the model
|
||||
$model->delete();
|
||||
|
||||
// Redirect to the models management page
|
||||
return Redirect::to('hardware/models')->with('success', trans('admin/models/message.delete.success'));
|
||||
return redirect()->to('hardware/models')->with('success', trans('admin/models/message.delete.success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,10 +317,10 @@ class AssetModelsController extends Controller
|
||||
$success = trans('admin/models/message.restore.success');
|
||||
|
||||
// Redirect back
|
||||
return Redirect::back()->with('success', $success);
|
||||
return redirect()->back()->with('success', $success);
|
||||
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('admin/models/message.not_found'));
|
||||
return redirect()->back()->with('error', trans('admin/models/message.not_found'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -345,7 +345,7 @@ class AssetModelsController extends Controller
|
||||
$error = trans('admin/models/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('models')->with('error', $error);
|
||||
return redirect()->route('models')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ class AssetModelsController extends Controller
|
||||
// Check if the model exists
|
||||
if (is_null($model_to_clone = AssetModel::find($modelId))) {
|
||||
// Redirect to the model management page
|
||||
return Redirect::to('assets/models')->with('error', trans('admin/models/message.does_not_exist'));
|
||||
return redirect()->to('assets/models')->with('error', trans('admin/models/message.does_not_exist'));
|
||||
}
|
||||
|
||||
$model = clone $model_to_clone;
|
||||
|
||||
@@ -214,10 +214,10 @@ class AssetsController extends Controller
|
||||
$log = $logaction->logaction('checkout');
|
||||
}
|
||||
// Redirect to the asset listing page
|
||||
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.create.success'));
|
||||
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($asset->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($asset->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -234,9 +234,9 @@ class AssetsController extends Controller
|
||||
// Check if the asset exists
|
||||
if (is_null($asset = Asset::find($assetId))) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
return redirect()->to('hardware')->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()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Grab the dropdown lists
|
||||
@@ -276,9 +276,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()->to('hardware')->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()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (e(Input::get('status_id')) == '') {
|
||||
@@ -359,10 +359,10 @@ class AssetsController extends Controller
|
||||
// Was the asset updated?
|
||||
if ($asset->save()) {
|
||||
// Redirect to the new asset page
|
||||
return Redirect::to("hardware/$assetId/view")->with('success', trans('admin/hardware/message.update.success'));
|
||||
return redirect()->to("hardware/$assetId/view")->with('success', trans('admin/hardware/message.update.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($asset->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($asset->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -379,9 +379,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()->to('hardware')->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()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
DB::table('assets')
|
||||
@@ -392,7 +392,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()->to('hardware')->with('success', trans('admin/hardware/message.delete.success'));
|
||||
|
||||
|
||||
|
||||
@@ -413,9 +413,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()->to('hardware')->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()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
@@ -438,9 +438,9 @@ 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()->to('hardware')->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()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$user = User::find(e(Input::get('assigned_to')));
|
||||
@@ -461,11 +461,11 @@ class AssetsController extends Controller
|
||||
|
||||
if ($asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), e(Input::get('name')))) {
|
||||
// Redirect to the new asset page
|
||||
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.checkout.success'));
|
||||
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.checkout.success'));
|
||||
}
|
||||
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to("hardware/$assetId/checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($asset->getErrors());
|
||||
return redirect()->to("hardware/$assetId/checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($asset->getErrors());
|
||||
}
|
||||
|
||||
|
||||
@@ -483,9 +483,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()->to('hardware')->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()->to('hardware')->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);
|
||||
@@ -505,9 +505,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()->to('hardware')->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()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$admin = Auth::user();
|
||||
@@ -515,7 +515,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()->to('hardware')->with('error', trans('admin/hardware/message.checkin.already_checked_in'));
|
||||
}
|
||||
|
||||
// This is just used for the redirect
|
||||
@@ -586,15 +586,15 @@ class AssetsController extends Controller
|
||||
}
|
||||
|
||||
if ($backto=='user') {
|
||||
return Redirect::to("admin/users/".$return_to.'/view')->with('success', trans('admin/hardware/message.checkin.success'));
|
||||
return redirect()->to("admin/users/".$return_to.'/view')->with('success', trans('admin/hardware/message.checkin.success'));
|
||||
} else {
|
||||
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.checkin.success'));
|
||||
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.checkin.success'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to("hardware")->with('error', trans('admin/hardware/message.checkin.error'));
|
||||
return redirect()->to("hardware")->with('error', trans('admin/hardware/message.checkin.error'));
|
||||
}
|
||||
|
||||
|
||||
@@ -612,7 +612,7 @@ class AssetsController extends Controller
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
} elseif ($asset->userloc) {
|
||||
$use_currency = $asset->userloc->currency;
|
||||
} elseif ($asset->assetloc) {
|
||||
@@ -643,7 +643,7 @@ class AssetsController extends Controller
|
||||
$error = trans('admin/hardware/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('hardware')->with('error', $error);
|
||||
return redirect()->route('hardware')->with('error', $error);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -665,7 +665,7 @@ class AssetsController extends Controller
|
||||
$size = Helper::barcodeDimensions($settings->barcode_type);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (isset($asset->id,$asset->asset_tag)) {
|
||||
@@ -693,7 +693,7 @@ class AssetsController extends Controller
|
||||
$files = array();
|
||||
|
||||
if (!Company::isCurrentUserAuthorized()) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if ($handle = opendir($path)) {
|
||||
@@ -730,7 +730,7 @@ class AssetsController extends Controller
|
||||
{
|
||||
|
||||
if (!Company::isCurrentUserAuthorized()) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
|
||||
} elseif (!config('app.lock_passwords')) {
|
||||
|
||||
@@ -789,7 +789,7 @@ class AssetsController extends Controller
|
||||
// php artisan asset-import:csv path/to/your/file.csv --domain=yourdomain.com --email_format=firstname.lastname
|
||||
|
||||
if (!Company::isCurrentUserAuthorized()) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$output = new BufferedOutput;
|
||||
@@ -799,7 +799,7 @@ class AssetsController extends Controller
|
||||
file_put_contents($file, $display_output);
|
||||
|
||||
|
||||
return Redirect::to('hardware')->with('success', 'Your file has been imported');
|
||||
return redirect()->to('hardware')->with('success', 'Your file has been imported');
|
||||
|
||||
}
|
||||
|
||||
@@ -816,9 +816,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()->to('hardware')->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()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Grab the dropdown lists
|
||||
@@ -868,15 +868,15 @@ 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()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
} elseif (isset($asset->id)) {
|
||||
|
||||
// Restore the asset
|
||||
Asset::withTrashed()->where('id',$assetId)->restore();
|
||||
return Redirect::route('hardware')->with('success', trans('admin/hardware/message.restore.success'));
|
||||
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()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -894,7 +894,7 @@ class AssetsController extends Controller
|
||||
{
|
||||
|
||||
if (!$asset = Asset::find($assetId)) {
|
||||
return Redirect::route('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
return redirect()->route('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
$destinationPath = config('app.private_uploads').'/assets';
|
||||
@@ -902,7 +902,7 @@ class AssetsController extends Controller
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (Input::hasFile('assetfile')) {
|
||||
@@ -925,13 +925,13 @@ class AssetsController extends Controller
|
||||
$log = $logaction->logaction('uploaded');
|
||||
}
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('admin/hardware/message.upload.nofiles'));
|
||||
return redirect()->back()->with('error', trans('admin/hardware/message.upload.nofiles'));
|
||||
}
|
||||
|
||||
if ($upload_success) {
|
||||
return Redirect::back()->with('success', trans('admin/hardware/message.upload.success'));
|
||||
return redirect()->back()->with('success', trans('admin/hardware/message.upload.success'));
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('admin/hardware/message.upload.error'));
|
||||
return redirect()->back()->with('error', trans('admin/hardware/message.upload.error'));
|
||||
}
|
||||
|
||||
|
||||
@@ -957,7 +957,7 @@ class AssetsController extends Controller
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
@@ -966,14 +966,14 @@ class AssetsController extends Controller
|
||||
unlink($destinationPath.'/'.$log->filename);
|
||||
}
|
||||
$log->delete();
|
||||
return Redirect::back()->with('success', trans('admin/hardware/message.deletefile.success'));
|
||||
return redirect()->back()->with('success', trans('admin/hardware/message.deletefile.success'));
|
||||
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = trans('admin/hardware/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the hardware management page
|
||||
return Redirect::route('hardware')->with('error', $error);
|
||||
return redirect()->route('hardware')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -998,7 +998,7 @@ class AssetsController extends Controller
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
@@ -1018,7 +1018,7 @@ class AssetsController extends Controller
|
||||
$error = trans('admin/hardware/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the hardware management page
|
||||
return Redirect::route('hardware')->with('error', $error);
|
||||
return redirect()->route('hardware')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1037,10 +1037,10 @@ class AssetsController extends Controller
|
||||
{
|
||||
|
||||
if (!Company::isCurrentUserAuthorized()) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
|
||||
} elseif (!Input::has('edit_asset')) {
|
||||
return Redirect::back()->with('error', 'No assets selected');
|
||||
return redirect()->back()->with('error', 'No assets selected');
|
||||
|
||||
} else {
|
||||
$asset_raw_array = Input::get('edit_asset');
|
||||
@@ -1069,7 +1069,7 @@ class AssetsController extends Controller
|
||||
|
||||
} else {
|
||||
// QR codes are not enabled
|
||||
return Redirect::to("hardware")->with('error', 'Barcodes are not enabled in Admin > Settings');
|
||||
return redirect()->to("hardware")->with('error', 'Barcodes are not enabled in Admin > Settings');
|
||||
}
|
||||
|
||||
} elseif (Input::get('bulk_actions')=='delete') {
|
||||
@@ -1100,7 +1100,7 @@ class AssetsController extends Controller
|
||||
}
|
||||
|
||||
} else {
|
||||
return Redirect::back()->with('error', 'No action selected');
|
||||
return redirect()->back()->with('error', 'No action selected');
|
||||
}
|
||||
|
||||
|
||||
@@ -1121,7 +1121,7 @@ class AssetsController extends Controller
|
||||
{
|
||||
|
||||
if (!Company::isCurrentUserAuthorized()) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
|
||||
} elseif (Input::has('bulk_edit')) {
|
||||
|
||||
@@ -1198,18 +1198,18 @@ class AssetsController extends Controller
|
||||
|
||||
} // endforeach
|
||||
|
||||
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.update.success'));
|
||||
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.update.success'));
|
||||
|
||||
// no values given, nothing to update
|
||||
} else {
|
||||
return Redirect::to("hardware")->with('info', trans('admin/hardware/message.update.nothing_updated'));
|
||||
return redirect()->to("hardware")->with('info', trans('admin/hardware/message.update.nothing_updated'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // endif
|
||||
|
||||
return Redirect::to("hardware");
|
||||
return redirect()->to("hardware");
|
||||
|
||||
}
|
||||
|
||||
@@ -1225,7 +1225,7 @@ class AssetsController extends Controller
|
||||
{
|
||||
|
||||
if (!Company::isCurrentUserAuthorized()) {
|
||||
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
} elseif (Input::has('bulk_edit')) {
|
||||
//$assets = Input::get('bulk_edit');
|
||||
$assets = Asset::find(Input::get('bulk_edit'));
|
||||
@@ -1251,16 +1251,16 @@ class AssetsController extends Controller
|
||||
}
|
||||
|
||||
} // endforeach
|
||||
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.delete.success'));
|
||||
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.delete.success'));
|
||||
|
||||
// no values given, nothing to update
|
||||
} else {
|
||||
return Redirect::to("hardware")->with('info', trans('admin/hardware/message.delete.nothing_updated'));
|
||||
return redirect()->to("hardware")->with('info', trans('admin/hardware/message.delete.nothing_updated'));
|
||||
|
||||
}
|
||||
|
||||
// Something weird happened here - default to hardware
|
||||
return Redirect::to("hardware");
|
||||
return redirect()->to("hardware");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ class AuthController extends Controller
|
||||
$validator = $this->validator(Input::all());
|
||||
|
||||
if ($validator->fails()) {
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
return redirect()->back()->withInput()->withErrors($validator);
|
||||
}
|
||||
|
||||
// Should we even check for LDAP users?
|
||||
@@ -229,7 +229,7 @@ class AuthController extends Controller
|
||||
if (!Auth::attempt(Input::only('username', 'password'), Input::get('remember-me', 0))) {
|
||||
LOG::debug("Local authentication failed.");
|
||||
// throw new Cartalyst\Sentry\Users\UserNotFoundException();
|
||||
return Redirect::back()->withInput()->with('error', trans('auth/message.account_not_found'));
|
||||
return redirect()->back()->withInput()->with('error', trans('auth/message.account_not_found'));
|
||||
}
|
||||
|
||||
// Get the page we were before
|
||||
@@ -239,10 +239,10 @@ class AuthController extends Controller
|
||||
\Session::forget('loginRedirect');
|
||||
|
||||
// Redirect to the users page
|
||||
return Redirect::to($redirect)->with('success', trans('auth/message.signin.success'));
|
||||
return redirect()->to($redirect)->with('success', trans('auth/message.signin.success'));
|
||||
|
||||
// Ooops.. something went wrong
|
||||
return Redirect::back()->withInput()->withErrors($this->messageBag);
|
||||
return redirect()->back()->withInput()->withErrors($this->messageBag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,7 +256,7 @@ class AuthController extends Controller
|
||||
Auth::logout();
|
||||
|
||||
// Redirect to the users page
|
||||
return Redirect::route('home')->with('success', 'You have successfully logged out!');
|
||||
return redirect()->route('home')->with('success', 'You have successfully logged out!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,16 +81,16 @@ class CategoriesController extends Controller
|
||||
|
||||
if ($category->save()) {
|
||||
// Redirect to the new category page
|
||||
return Redirect::to("admin/settings/categories")->with('success', trans('admin/categories/message.create.success'));
|
||||
return redirect()->to("admin/settings/categories")->with('success', trans('admin/categories/message.create.success'));
|
||||
} else {
|
||||
|
||||
// The given data did not pass validation
|
||||
return Redirect::back()->withInput()->withErrors($category->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($category->getErrors());
|
||||
|
||||
}
|
||||
|
||||
// Redirect to the category create page
|
||||
return Redirect::to('admin/settings/categories/create')->with('error', trans('admin/categories/message.create.error'));
|
||||
return redirect()->to('admin/settings/categories/create')->with('error', trans('admin/categories/message.create.error'));
|
||||
|
||||
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class CategoriesController extends Controller
|
||||
// Check if the category exists
|
||||
if (is_null($category = Category::find($categoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
@@ -138,7 +138,7 @@ class CategoriesController extends Controller
|
||||
// Check if the blog post exists
|
||||
if (is_null($category = Category::find($categoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/categories')->with('error', trans('admin/categories/message.does_not_exist'));
|
||||
return redirect()->to('admin/categories')->with('error', trans('admin/categories/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Update the category data
|
||||
@@ -151,15 +151,15 @@ class CategoriesController extends Controller
|
||||
|
||||
if ($category->save()) {
|
||||
// Redirect to the new category page
|
||||
return Redirect::to("admin/settings/categories")->with('success', trans('admin/categories/message.update.success'));
|
||||
return redirect()->to("admin/settings/categories")->with('success', trans('admin/categories/message.update.success'));
|
||||
} // attempt validation
|
||||
else {
|
||||
// The given data did not pass validation
|
||||
return Redirect::back()->withInput()->withErrors($category->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($category->getErrors());
|
||||
}
|
||||
|
||||
// Redirect to the category management page
|
||||
return Redirect::back()->with('error', trans('admin/categories/message.update.error'));
|
||||
return redirect()->back()->with('error', trans('admin/categories/message.update.error'));
|
||||
|
||||
}
|
||||
|
||||
@@ -176,27 +176,27 @@ class CategoriesController extends Controller
|
||||
// Check if the category exists
|
||||
if (is_null($category = Category::find($categoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.not_found'));
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.not_found'));
|
||||
}
|
||||
|
||||
|
||||
if ($category->has_models() > 0) {
|
||||
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_models'));
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_models'));
|
||||
|
||||
} elseif ($category->accessories()->count() > 0) {
|
||||
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_accessories'));
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_accessories'));
|
||||
|
||||
} elseif ($category->consumables()->count() > 0) {
|
||||
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_consumables'));
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_consumables'));
|
||||
|
||||
} elseif ($category->components()->count() > 0) {
|
||||
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_components'));
|
||||
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_components'));
|
||||
} else {
|
||||
|
||||
$category->delete();
|
||||
|
||||
// Redirect to the locations management page
|
||||
return Redirect::to('admin/settings/categories')->with('success', trans('admin/categories/message.delete.success'));
|
||||
return redirect()->to('admin/settings/categories')->with('success', trans('admin/categories/message.delete.success'));
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ class CategoriesController extends Controller
|
||||
$error = trans('admin/categories/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('categories')->with('error', $error);
|
||||
return redirect()->route('categories')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,10 +55,10 @@ final class CompaniesController extends Controller
|
||||
$company->name = e(Input::get('name'));
|
||||
|
||||
if ($company->save()) {
|
||||
return Redirect::to('admin/settings/companies')
|
||||
return redirect()->to('admin/settings/companies')
|
||||
->with('success', trans('admin/companies/message.create.success'));
|
||||
} else {
|
||||
return Redirect::back()->withInput()->withErrors($company->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($company->getErrors());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -75,7 +75,7 @@ final class CompaniesController extends Controller
|
||||
public function getEdit($companyId)
|
||||
{
|
||||
if (is_null($company = Company::find($companyId))) {
|
||||
return Redirect::to('admin/settings/companies')
|
||||
return redirect()->to('admin/settings/companies')
|
||||
->with('error', trans('admin/companies/message.does_not_exist'));
|
||||
} else {
|
||||
return View::make('companies/edit')->with('company', $company);
|
||||
@@ -93,17 +93,17 @@ final class CompaniesController extends Controller
|
||||
public function postEdit($companyId)
|
||||
{
|
||||
if (is_null($company = Company::find($companyId))) {
|
||||
return Redirect::to('admin/settings/companies')->with('error', trans('admin/companies/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/companies')->with('error', trans('admin/companies/message.does_not_exist'));
|
||||
} else {
|
||||
|
||||
|
||||
$company->name = e(Input::get('name'));
|
||||
|
||||
if ($company->save()) {
|
||||
return Redirect::to('admin/settings/companies')
|
||||
return redirect()->to('admin/settings/companies')
|
||||
->with('success', trans('admin/companies/message.update.success'));
|
||||
} else {
|
||||
return Redirect::to("admin/settings/companies/$companyId/edit")
|
||||
return redirect()->to("admin/settings/companies/$companyId/edit")
|
||||
->with('error', trans('admin/companies/message.update.error'));
|
||||
}
|
||||
|
||||
@@ -121,12 +121,12 @@ final class CompaniesController extends Controller
|
||||
public function postDelete($companyId)
|
||||
{
|
||||
if (is_null($company = Company::find($companyId))) {
|
||||
return Redirect::to('admin/settings/companies')
|
||||
return redirect()->to('admin/settings/companies')
|
||||
->with('error', trans('admin/companies/message.not_found'));
|
||||
} else {
|
||||
try {
|
||||
$company->delete();
|
||||
return Redirect::to('admin/settings/companies')
|
||||
return redirect()->to('admin/settings/companies')
|
||||
->with('success', trans('admin/companies/message.delete.success'));
|
||||
} catch (\Illuminate\Database\QueryException $exception) {
|
||||
/*
|
||||
@@ -134,7 +134,7 @@ final class CompaniesController extends Controller
|
||||
* For example when rows in other tables are referencing this company
|
||||
*/
|
||||
if ($exception->getCode() == 23000) {
|
||||
return Redirect::to('admin/settings/companies')
|
||||
return redirect()->to('admin/settings/companies')
|
||||
->with('error', trans('admin/companies/message.assoc_users'));
|
||||
} else {
|
||||
throw $exception;
|
||||
|
||||
@@ -106,10 +106,10 @@ class ComponentsController extends Controller
|
||||
// Was the component created?
|
||||
if ($component->save()) {
|
||||
// Redirect to the new component page
|
||||
return Redirect::to("admin/components")->with('success', trans('admin/components/message.create.success'));
|
||||
return redirect()->to("admin/components")->with('success', trans('admin/components/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($component->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($component->getErrors());
|
||||
|
||||
|
||||
}
|
||||
@@ -128,9 +128,9 @@ class ComponentsController extends Controller
|
||||
// Check if the component exists
|
||||
if (is_null($component = Component::find($componentId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/components')->with('error', trans('admin/components/message.does_not_exist'));
|
||||
return redirect()->to('admin/components')->with('error', trans('admin/components/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($component)) {
|
||||
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = Helper::categoryList();
|
||||
@@ -158,9 +158,9 @@ class ComponentsController extends Controller
|
||||
// Check if the blog post exists
|
||||
if (is_null($component = Component::find($componentId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/components')->with('error', trans('admin/components/message.does_not_exist'));
|
||||
return redirect()->to('admin/components')->with('error', trans('admin/components/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($component)) {
|
||||
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
|
||||
@@ -189,10 +189,10 @@ class ComponentsController extends Controller
|
||||
// Was the component created?
|
||||
if ($component->save()) {
|
||||
// Redirect to the new component page
|
||||
return Redirect::to("admin/components")->with('success', trans('admin/components/message.update.success'));
|
||||
return redirect()->to("admin/components")->with('success', trans('admin/components/message.update.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($component->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($component->getErrors());
|
||||
|
||||
|
||||
|
||||
@@ -212,15 +212,15 @@ class ComponentsController extends Controller
|
||||
// Check if the blog post exists
|
||||
if (is_null($component = Component::find($componentId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/components')->with('error', trans('admin/components/message.not_found'));
|
||||
return redirect()->to('admin/components')->with('error', trans('admin/components/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($component)) {
|
||||
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$component->delete();
|
||||
|
||||
// Redirect to the locations management page
|
||||
return Redirect::to('admin/components')->with('success', trans('admin/components/message.delete.success'));
|
||||
return redirect()->to('admin/components')->with('success', trans('admin/components/message.delete.success'));
|
||||
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ class ComponentsController extends Controller
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($component)) {
|
||||
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('components/view', compact('component'));
|
||||
}
|
||||
@@ -261,7 +261,7 @@ class ComponentsController extends Controller
|
||||
$error = trans('admin/components/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('components')->with('error', $error);
|
||||
return redirect()->route('components')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
@@ -281,9 +281,9 @@ 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()->to('components')->with('error', trans('admin/components/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($component)) {
|
||||
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get the dropdown of assets and then pass it to the checkout view
|
||||
@@ -307,9 +307,9 @@ 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()->to('components')->with('error', trans('admin/components/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($component)) {
|
||||
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$admin_user = Auth::user();
|
||||
@@ -318,7 +318,7 @@ class ComponentsController extends Controller
|
||||
// Check if the user exists
|
||||
if (is_null($asset = Asset::find($asset_id))) {
|
||||
// Redirect to the component management page with error
|
||||
return Redirect::to('admin/components')->with('error', trans('admin/components/message.asset_does_not_exist'));
|
||||
return redirect()->to('admin/components')->with('error', trans('admin/components/message.asset_does_not_exist'));
|
||||
}
|
||||
|
||||
// Update the component data
|
||||
@@ -375,7 +375,7 @@ class ComponentsController extends Controller
|
||||
$log = $logaction->logaction('checkout');
|
||||
|
||||
// Redirect to the new component page
|
||||
return Redirect::to("admin/components")->with('success', trans('admin/components/message.checkout.success'));
|
||||
return redirect()->to("admin/components")->with('success', trans('admin/components/message.checkout.success'));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -100,10 +100,10 @@ class ConsumablesController extends Controller
|
||||
// Was the consumable created?
|
||||
if ($consumable->save()) {
|
||||
// Redirect to the new consumable page
|
||||
return Redirect::to("admin/consumables")->with('success', trans('admin/consumables/message.create.success'));
|
||||
return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($consumable->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($consumable->getErrors());
|
||||
|
||||
|
||||
}
|
||||
@@ -122,9 +122,9 @@ class ConsumablesController extends Controller
|
||||
// Check if the consumable exists
|
||||
if (is_null($consumable = Consumable::find($consumableId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/consumables')->with('error', trans('admin/consumables/message.does_not_exist'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('admin/consumables/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = Helper::categoryList();
|
||||
@@ -150,9 +150,9 @@ class ConsumablesController extends Controller
|
||||
public function postEdit($consumableId = null)
|
||||
{
|
||||
if (is_null($consumable = Consumable::find($consumableId))) {
|
||||
return Redirect::to('admin/consumables')->with('error', trans('admin/consumables/message.does_not_exist'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('admin/consumables/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$consumable->name = e(Input::get('name'));
|
||||
@@ -177,10 +177,10 @@ class ConsumablesController extends Controller
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
|
||||
if ($consumable->save()) {
|
||||
return Redirect::to("admin/consumables")->with('success', trans('admin/consumables/message.update.success'));
|
||||
return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.update.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($consumable->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($consumable->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -197,15 +197,15 @@ class ConsumablesController extends Controller
|
||||
// Check if the blog post exists
|
||||
if (is_null($consumable = Consumable::find($consumableId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/consumables')->with('error', trans('admin/consumables/message.not_found'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('admin/consumables/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$consumable->delete();
|
||||
|
||||
// Redirect to the locations management page
|
||||
return Redirect::to('admin/consumables')->with('success', trans('admin/consumables/message.delete.success'));
|
||||
return redirect()->to('admin/consumables')->with('success', trans('admin/consumables/message.delete.success'));
|
||||
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ class ConsumablesController extends Controller
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('consumables/view', compact('consumable'));
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class ConsumablesController extends Controller
|
||||
$error = trans('admin/consumables/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('consumables')->with('error', $error);
|
||||
return redirect()->route('consumables')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
@@ -257,9 +257,9 @@ 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()->to('consumables')->with('error', trans('admin/consumables/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
@@ -283,9 +283,9 @@ 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()->to('consumables')->with('error', trans('admin/consumables/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$admin_user = Auth::user();
|
||||
@@ -294,7 +294,7 @@ class ConsumablesController extends Controller
|
||||
// Check if the user exists
|
||||
if (is_null($user = User::find($assigned_to))) {
|
||||
// Redirect to the consumable management page with error
|
||||
return Redirect::to('admin/consumables')->with('error', trans('admin/consumables/message.user_does_not_exist'));
|
||||
return redirect()->to('admin/consumables')->with('error', trans('admin/consumables/message.user_does_not_exist'));
|
||||
}
|
||||
|
||||
// Update the consumable data
|
||||
@@ -370,7 +370,7 @@ class ConsumablesController extends Controller
|
||||
}
|
||||
|
||||
// Redirect to the new consumable page
|
||||
return Redirect::to("admin/consumables")->with('success', trans('admin/consumables/message.checkout.success'));
|
||||
return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.checkout.success'));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@ class CustomFieldsController extends Controller
|
||||
$validator=Validator::make(Input::all(), $cfset->rules);
|
||||
if ($validator->passes()) {
|
||||
$cfset->save();
|
||||
return Redirect::route("admin.custom_fields.show", [$cfset->id])->with('success', trans('admin/custom_fields/message.fieldset.create.success'));
|
||||
return redirect()->route("admin.custom_fields.show", [$cfset->id])->with('success', trans('admin/custom_fields/message.fieldset.create.success'));
|
||||
} else {
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
return redirect()->back()->withInput()->withErrors($validator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,13 +90,13 @@ class CustomFieldsController extends Controller
|
||||
|
||||
foreach ($set->fields as $field) {
|
||||
if ($field->id == Input::get('field_id')) {
|
||||
return Redirect::route("admin.custom_fields.show", [$id])->withInput()->withErrors(['field_id' => trans('admin/custom_fields/message.field.already_added')]);
|
||||
return redirect()->route("admin.custom_fields.show", [$id])->withInput()->withErrors(['field_id' => trans('admin/custom_fields/message.field.already_added')]);
|
||||
}
|
||||
}
|
||||
|
||||
$results=$set->fields()->attach(Input::get('field_id'), ["required" => (Input::get('required') == "on"),"order" => Input::get('order')]);
|
||||
|
||||
return Redirect::route("admin.custom_fields.show", [$id])->with("success", trans('admin/custom_fields/message.field.create.assoc_success'));
|
||||
return redirect()->route("admin.custom_fields.show", [$id])->with("success", trans('admin/custom_fields/message.field.create.assoc_success'));
|
||||
}
|
||||
|
||||
|
||||
@@ -138,12 +138,12 @@ class CustomFieldsController extends Controller
|
||||
$results=$field->save();
|
||||
//return "postCreateField: $results";
|
||||
if ($results) {
|
||||
return Redirect::route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.field.create.success'));
|
||||
return redirect()->route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.field.create.success'));
|
||||
} else {
|
||||
return Redirect::back()->withInput()->with('error', trans('admin/custom_fields/message.field.create.error'));
|
||||
return redirect()->back()->withInput()->with('error', trans('admin/custom_fields/message.field.create.error'));
|
||||
}
|
||||
} else {
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
return redirect()->back()->withInput()->withErrors($validator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,10 +159,10 @@ class CustomFieldsController extends Controller
|
||||
$field=CustomField::find($field_id);
|
||||
|
||||
if ($field->fieldset->count()>0) {
|
||||
return Redirect::back()->withErrors(['message' => "Field is in-use"]);
|
||||
return redirect()->back()->withErrors(['message' => "Field is in-use"]);
|
||||
} else {
|
||||
$field->delete();
|
||||
return Redirect::route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.field.delete.success'));
|
||||
return redirect()->route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.field.delete.success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,9 +245,9 @@ class CustomFieldsController extends Controller
|
||||
$models = AssetModel::where("fieldset_id", "=", $id);
|
||||
if ($models->count()==0) {
|
||||
$fieldset->delete();
|
||||
return Redirect::route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.fieldset.delete.success'));
|
||||
return redirect()->route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.fieldset.delete.success'));
|
||||
} else {
|
||||
return Redirect::route("admin.custom_fields.index")->with("error", trans('admin/custom_fields/message.fieldset.delete.in_use')); //->with("models",$models);
|
||||
return redirect()->route("admin.custom_fields.index")->with("error", trans('admin/custom_fields/message.fieldset.delete.in_use')); //->with("models",$models);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class DashboardController extends Controller
|
||||
return View::make('dashboard')->with('asset_stats', $asset_stats)->with('recent_activity', $recent_activity);
|
||||
} else {
|
||||
// Redirect to the profile page
|
||||
return Redirect::route('view-assets');
|
||||
return redirect()->route('view-assets');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,10 +76,10 @@ class DepreciationsController extends Controller
|
||||
// Was the asset created?
|
||||
if ($depreciation->save()) {
|
||||
// Redirect to the new depreciation page
|
||||
return Redirect::to("admin/settings/depreciations")->with('success', trans('admin/depreciations/message.create.success'));
|
||||
return redirect()->to("admin/settings/depreciations")->with('success', trans('admin/depreciations/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($depreciation->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($depreciation->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class DepreciationsController extends Controller
|
||||
// Check if the depreciation exists
|
||||
if (is_null($depreciation = Depreciation::find($depreciationId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.does_not_exist'));
|
||||
}
|
||||
|
||||
return View::make('depreciations/edit', compact('depreciation'));
|
||||
@@ -118,7 +118,7 @@ class DepreciationsController extends Controller
|
||||
// Check if the depreciation exists
|
||||
if (is_null($depreciation = Depreciation::find($depreciationId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Depreciation data
|
||||
@@ -128,10 +128,10 @@ class DepreciationsController extends Controller
|
||||
// Was the asset created?
|
||||
if ($depreciation->save()) {
|
||||
// Redirect to the depreciation page
|
||||
return Redirect::to("admin/settings/depreciations/")->with('success', trans('admin/depreciations/message.update.success'));
|
||||
return redirect()->to("admin/settings/depreciations/")->with('success', trans('admin/depreciations/message.update.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($depreciation->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($depreciation->getErrors());
|
||||
|
||||
|
||||
}
|
||||
@@ -150,19 +150,19 @@ class DepreciationsController extends Controller
|
||||
// Check if the depreciation exists
|
||||
if (is_null($depreciation = Depreciation::find($depreciationId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.not_found'));
|
||||
return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.not_found'));
|
||||
}
|
||||
|
||||
if ($depreciation->has_models() > 0) {
|
||||
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.assoc_users'));
|
||||
return redirect()->to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.assoc_users'));
|
||||
} else {
|
||||
|
||||
$depreciation->delete();
|
||||
|
||||
// Redirect to the depreciations management page
|
||||
return Redirect::to('admin/settings/depreciations')->with('success', trans('admin/depreciations/message.delete.success'));
|
||||
return redirect()->to('admin/settings/depreciations')->with('success', trans('admin/depreciations/message.delete.success'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ class GroupsController extends Controller
|
||||
$group->permissions = json_encode(Input::get('permission'));
|
||||
|
||||
if ($group->save()) {
|
||||
return Redirect::to("admin/groups")->with('success', trans('admin/groups/message.create.success'));
|
||||
return redirect()->to("admin/groups")->with('success', trans('admin/groups/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($group->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($group->getErrors());
|
||||
|
||||
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class GroupsController extends Controller
|
||||
{
|
||||
$permissions = config('permissions');
|
||||
if (!$group = Group::find($id)) {
|
||||
return Redirect::route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
|
||||
return redirect()->route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
|
||||
|
||||
}
|
||||
$group->name = e(Input::get('name'));
|
||||
@@ -119,12 +119,12 @@ class GroupsController extends Controller
|
||||
if (!config('app.lock_passwords')) {
|
||||
|
||||
if ($group->save()) {
|
||||
return Redirect::to("admin/groups")->with('success', trans('admin/groups/message.create.success'));
|
||||
return redirect()->to("admin/groups")->with('success', trans('admin/groups/message.create.success'));
|
||||
}
|
||||
return Redirect::back()->withInput()->withErrors($group->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($group->getErrors());
|
||||
|
||||
} else {
|
||||
return Redirect::route('update/group', $id)->withInput()->with('error', 'Denied! Editing groups is not allowed in the demo.');
|
||||
return redirect()->route('update/group', $id)->withInput()->with('error', 'Denied! Editing groups is not allowed in the demo.');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -147,13 +147,13 @@ class GroupsController extends Controller
|
||||
$group->delete();
|
||||
|
||||
// Redirect to the group management page
|
||||
return Redirect::route('groups')->with('success', trans('admin/groups/message.success.delete'));
|
||||
return redirect()->route('groups')->with('success', trans('admin/groups/message.success.delete'));
|
||||
} catch (GroupNotFoundException $e) {
|
||||
// Redirect to the group management page
|
||||
return Redirect::route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
|
||||
return redirect()->route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
|
||||
}
|
||||
} else {
|
||||
return Redirect::route('groups')->with('error', trans('general.feature_disabled'));
|
||||
return redirect()->route('groups')->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,10 +167,10 @@ class LicensesController extends Controller
|
||||
|
||||
|
||||
// Redirect to the new license page
|
||||
return Redirect::to("admin/licenses")->with('success', trans('admin/licenses/message.create.success'));
|
||||
return redirect()->to("admin/licenses")->with('success', trans('admin/licenses/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($license->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($license->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -188,9 +188,9 @@ class LicensesController extends Controller
|
||||
// Check if the license exists
|
||||
if (is_null($license = License::find($licenseId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if ($license->purchase_date == "0000-00-00") {
|
||||
@@ -232,9 +232,9 @@ class LicensesController extends Controller
|
||||
// Check if the license exists
|
||||
if (is_null($license = License::find($licenseId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Update the license data
|
||||
@@ -330,7 +330,7 @@ class LicensesController extends Controller
|
||||
|
||||
} else {
|
||||
// Redirect to the license edit page
|
||||
return Redirect::to("admin/licenses/$licenseId/edit")->with('error', trans('admin/licenses/message.assoc_users'));
|
||||
return redirect()->to("admin/licenses/$licenseId/edit")->with('error', trans('admin/licenses/message.assoc_users'));
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -358,12 +358,12 @@ class LicensesController extends Controller
|
||||
// Was the asset created?
|
||||
if ($license->save()) {
|
||||
// Redirect to the new license page
|
||||
return Redirect::to("admin/licenses/$licenseId/view")->with('success', trans('admin/licenses/message.update.success'));
|
||||
return redirect()->to("admin/licenses/$licenseId/view")->with('success', trans('admin/licenses/message.update.success'));
|
||||
}
|
||||
|
||||
|
||||
// Redirect to the license edit page
|
||||
return Redirect::to("admin/licenses/$licenseId/edit")->with('error', trans('admin/licenses/message.update.error'));
|
||||
return redirect()->to("admin/licenses/$licenseId/edit")->with('error', trans('admin/licenses/message.update.error'));
|
||||
|
||||
}
|
||||
|
||||
@@ -381,15 +381,15 @@ class LicensesController extends Controller
|
||||
// Check if the license exists
|
||||
if (is_null($license = License::find($licenseId))) {
|
||||
// Redirect to the license management page
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (($license->assignedcount()) && ($license->assignedcount() > 0)) {
|
||||
|
||||
// Redirect to the license management page
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.assoc_users'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.assoc_users'));
|
||||
|
||||
} else {
|
||||
|
||||
@@ -406,7 +406,7 @@ class LicensesController extends Controller
|
||||
|
||||
|
||||
// Redirect to the licenses management page
|
||||
return Redirect::to('admin/licenses')->with('success', trans('admin/licenses/message.delete.success'));
|
||||
return redirect()->to('admin/licenses')->with('success', trans('admin/licenses/message.delete.success'));
|
||||
}
|
||||
|
||||
|
||||
@@ -429,9 +429,9 @@ class LicensesController extends Controller
|
||||
// Check if the license seat exists
|
||||
if (is_null($licenseseat = LicenseSeat::find($seatId))) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($licenseseat->license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
@@ -492,7 +492,7 @@ class LicensesController extends Controller
|
||||
$user = Auth::user();
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($licenseseat->license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Declare the rules for the form validation
|
||||
@@ -508,14 +508,14 @@ class LicensesController extends Controller
|
||||
// If validation fails, we'll exit the operation now.
|
||||
if ($validator->fails()) {
|
||||
// Ooops.. something went wrong
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
return redirect()->back()->withInput()->withErrors($validator);
|
||||
}
|
||||
|
||||
if ($assigned_to!='') {
|
||||
// Check if the user exists
|
||||
if (is_null($is_assigned_to = User::find($assigned_to))) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.user_does_not_exist'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.user_does_not_exist'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,12 +523,12 @@ class LicensesController extends Controller
|
||||
|
||||
if (is_null($is_asset_id = Asset::find($asset_id))) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.asset_does_not_exist'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.asset_does_not_exist'));
|
||||
}
|
||||
|
||||
if (($is_asset_id->assigned_to!=$assigned_to) && ($assigned_to!='')) {
|
||||
//echo 'asset assigned to: '.$is_asset_id->assigned_to.'<br>license assigned to: '.$assigned_to;
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.owner_doesnt_match_asset'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.owner_doesnt_match_asset'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -538,7 +538,7 @@ class LicensesController extends Controller
|
||||
// Check if the asset exists
|
||||
if (is_null($licenseseat)) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
}
|
||||
|
||||
if (Input::get('asset_id') == '') {
|
||||
@@ -621,11 +621,11 @@ class LicensesController extends Controller
|
||||
|
||||
|
||||
// Redirect to the new asset page
|
||||
return Redirect::to("admin/licenses")->with('success', trans('admin/licenses/message.checkout.success'));
|
||||
return redirect()->to("admin/licenses")->with('success', trans('admin/licenses/message.checkout.success'));
|
||||
}
|
||||
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses/$assetId/checkout')->with('error', trans('admin/licenses/message.create.error'))->with('license', new License);
|
||||
return redirect()->to('admin/licenses/$assetId/checkout')->with('error', trans('admin/licenses/message.create.error'))->with('license', new License);
|
||||
}
|
||||
|
||||
|
||||
@@ -643,9 +643,9 @@ class LicensesController extends Controller
|
||||
// Check if the asset exists
|
||||
if (is_null($licenseseat = LicenseSeat::find($seatId))) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($licenseseat->license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
return View::make('licenses/checkin', compact('licenseseat'))->with('backto', $backto);
|
||||
|
||||
@@ -668,19 +668,19 @@ class LicensesController extends Controller
|
||||
// Check if the asset exists
|
||||
if (is_null($licenseseat = LicenseSeat::find($seatId))) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
}
|
||||
|
||||
$license = License::find($licenseseat->license_id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (!$license->reassignable) {
|
||||
// Not allowed to checkin
|
||||
Session::flash('error', 'License not reassignable.');
|
||||
return Redirect::back()->withInput();
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
// Declare the rules for the form validation
|
||||
@@ -695,7 +695,7 @@ class LicensesController extends Controller
|
||||
// If validation fails, we'll exit the operation now.
|
||||
if ($validator->fails()) {
|
||||
// Ooops.. something went wrong
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
return redirect()->back()->withInput()->withErrors($validator);
|
||||
}
|
||||
$return_to = $licenseseat->assigned_to;
|
||||
$logaction = new Actionlog();
|
||||
@@ -756,15 +756,15 @@ class LicensesController extends Controller
|
||||
|
||||
|
||||
if ($backto=='user') {
|
||||
return Redirect::to("admin/users/".$return_to.'/view')->with('success', trans('admin/licenses/message.checkin.success'));
|
||||
return redirect()->to("admin/users/".$return_to.'/view')->with('success', trans('admin/licenses/message.checkin.success'));
|
||||
} else {
|
||||
return Redirect::to("admin/licenses/".$licenseseat->license_id."/view")->with('success', trans('admin/licenses/message.checkin.success'));
|
||||
return redirect()->to("admin/licenses/".$licenseseat->license_id."/view")->with('success', trans('admin/licenses/message.checkin.success'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Redirect to the license page with error
|
||||
return Redirect::to("admin/licenses")->with('error', trans('admin/licenses/message.checkin.error'));
|
||||
return redirect()->to("admin/licenses")->with('error', trans('admin/licenses/message.checkin.error'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -783,7 +783,7 @@ class LicensesController extends Controller
|
||||
if (isset($license->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
return View::make('licenses/view', compact('license'));
|
||||
|
||||
@@ -792,7 +792,7 @@ class LicensesController extends Controller
|
||||
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('licenses')->with('error', $error);
|
||||
return redirect()->route('licenses')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -801,9 +801,9 @@ class LicensesController extends Controller
|
||||
// Check if the license exists
|
||||
if (is_null($license_to_clone = License::find($licenseId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($license_to_clone)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
@@ -849,7 +849,7 @@ class LicensesController extends Controller
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (Input::hasFile('licensefile')) {
|
||||
@@ -879,20 +879,20 @@ class LicensesController extends Controller
|
||||
$logaction->filename = $filename;
|
||||
$log = $logaction->logaction('uploaded');
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('admin/licenses/message.upload.invalidfiles'));
|
||||
return redirect()->back()->with('error', trans('admin/licenses/message.upload.invalidfiles'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($upload_success) {
|
||||
return Redirect::back()->with('success', trans('admin/licenses/message.upload.success'));
|
||||
return redirect()->back()->with('success', trans('admin/licenses/message.upload.success'));
|
||||
} else {
|
||||
return Redirect::back()->with('success', trans('admin/licenses/message.upload.error'));
|
||||
return redirect()->back()->with('success', trans('admin/licenses/message.upload.error'));
|
||||
}
|
||||
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('admin/licenses/message.upload.nofiles'));
|
||||
return redirect()->back()->with('error', trans('admin/licenses/message.upload.nofiles'));
|
||||
}
|
||||
|
||||
|
||||
@@ -901,7 +901,7 @@ class LicensesController extends Controller
|
||||
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the licence management page
|
||||
return Redirect::route('licenses')->with('error', $error);
|
||||
return redirect()->route('licenses')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ class LicensesController extends Controller
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
@@ -934,14 +934,14 @@ class LicensesController extends Controller
|
||||
unlink($destinationPath.'/'.$log->filename);
|
||||
}
|
||||
$log->delete();
|
||||
return Redirect::back()->with('success', trans('admin/licenses/message.deletefile.success'));
|
||||
return redirect()->back()->with('success', trans('admin/licenses/message.deletefile.success'));
|
||||
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the licence management page
|
||||
return Redirect::route('licenses')->with('error', $error);
|
||||
return redirect()->route('licenses')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,7 +965,7 @@ class LicensesController extends Controller
|
||||
if (isset($license->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
@@ -976,7 +976,7 @@ class LicensesController extends Controller
|
||||
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the licence management page
|
||||
return Redirect::route('licenses')->with('error', $error);
|
||||
return redirect()->route('licenses')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1053,9 +1053,9 @@ class LicensesController extends Controller
|
||||
// Check if the asset exists
|
||||
if (is_null($license = License::find($licenseId))) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
|
||||
}
|
||||
$seatId = $license->freeSeat($licenseId);
|
||||
return Redirect::to('admin/licenses/'.$seatId.'/checkout');
|
||||
return redirect()->to('admin/licenses/'.$seatId.'/checkout');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,10 +99,10 @@ class LocationsController extends Controller
|
||||
|
||||
if ($location->save()) {
|
||||
// Redirect to the new location page
|
||||
return Redirect::to("admin/settings/locations")->with('success', trans('admin/locations/message.create.success'));
|
||||
return redirect()->to("admin/settings/locations")->with('success', trans('admin/locations/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($location->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($location->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class LocationsController extends Controller
|
||||
{
|
||||
// Check if the location exists
|
||||
if (is_null($location = Location::find($locationId))) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
@@ -187,7 +187,7 @@ class LocationsController extends Controller
|
||||
// Check if the location exists
|
||||
if (is_null($location = Location::find($locationId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Update the location data
|
||||
@@ -208,11 +208,11 @@ class LocationsController extends Controller
|
||||
// Was the asset created?
|
||||
if ($location->save()) {
|
||||
// Redirect to the saved location page
|
||||
return Redirect::to("admin/settings/locations/")->with('success', trans('admin/locations/message.update.success'));
|
||||
return redirect()->to("admin/settings/locations/")->with('success', trans('admin/locations/message.update.success'));
|
||||
}
|
||||
|
||||
// Redirect to the location management page
|
||||
return Redirect::back()->withInput()->withInput()->withErrors($location->getErrors());
|
||||
return redirect()->back()->withInput()->withInput()->withErrors($location->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -229,21 +229,21 @@ class LocationsController extends Controller
|
||||
// Check if the location exists
|
||||
if (is_null($location = Location::find($locationId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.not_found'));
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.not_found'));
|
||||
}
|
||||
|
||||
|
||||
if ($location->users->count() > 0) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_users'));
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_users'));
|
||||
} elseif ($location->childLocations->count() > 0) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_child_loc'));
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_child_loc'));
|
||||
} elseif ($location->assets->count() > 0) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_assets'));
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_assets'));
|
||||
} elseif ($location->assignedassets->count() > 0) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_assets'));
|
||||
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_assets'));
|
||||
} else {
|
||||
$location->delete();
|
||||
return Redirect::to('admin/settings/locations')->with('success', trans('admin/locations/message.delete.success'));
|
||||
return redirect()->to('admin/settings/locations')->with('success', trans('admin/locations/message.delete.success'));
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ class LocationsController extends Controller
|
||||
$error = trans('admin/locations/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('locations')->with('error', $error);
|
||||
return redirect()->route('locations')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ class ManufacturersController extends Controller
|
||||
$manufacturer->user_id = Auth::user()->id;
|
||||
|
||||
if ($manufacturer->save()) {
|
||||
return Redirect::to("admin/settings/manufacturers")->with('success', trans('admin/manufacturers/message.create.success'));
|
||||
return redirect()->to("admin/settings/manufacturers")->with('success', trans('admin/manufacturers/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($manufacturer->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($manufacturer->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class ManufacturersController extends Controller
|
||||
// Check if the manufacturer exists
|
||||
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
||||
// Redirect to the manufacturer page
|
||||
return Redirect::to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
@@ -107,7 +107,7 @@ class ManufacturersController extends Controller
|
||||
// Check if the manufacturer exists
|
||||
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
||||
// Redirect to the manufacturer page
|
||||
return Redirect::to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Save the data
|
||||
@@ -116,10 +116,10 @@ class ManufacturersController extends Controller
|
||||
// Was it created?
|
||||
if ($manufacturer->save()) {
|
||||
// Redirect to the new manufacturer page
|
||||
return Redirect::to("admin/settings/manufacturers")->with('success', trans('admin/manufacturers/message.update.success'));
|
||||
return redirect()->to("admin/settings/manufacturers")->with('success', trans('admin/manufacturers/message.update.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($manufacturer->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($manufacturer->getErrors());
|
||||
|
||||
|
||||
}
|
||||
@@ -137,20 +137,20 @@ class ManufacturersController extends Controller
|
||||
// Check if the manufacturer exists
|
||||
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
||||
// Redirect to the manufacturers page
|
||||
return Redirect::to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.not_found'));
|
||||
return redirect()->to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.not_found'));
|
||||
}
|
||||
|
||||
if ($manufacturer->has_models() > 0) {
|
||||
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.assoc_users'));
|
||||
return redirect()->to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.assoc_users'));
|
||||
} else {
|
||||
|
||||
// Delete the manufacturer
|
||||
$manufacturer->delete();
|
||||
|
||||
// Redirect to the manufacturers management page
|
||||
return Redirect::to('admin/settings/manufacturers')->with('success', trans('admin/manufacturers/message.delete.success'));
|
||||
return redirect()->to('admin/settings/manufacturers')->with('success', trans('admin/manufacturers/message.delete.success'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -179,7 +179,7 @@ class ManufacturersController extends Controller
|
||||
$error = trans('admin/manufacturers/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('manufacturers')->with('error', $error);
|
||||
return redirect()->route('manufacturers')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
if ($user->save()) {
|
||||
return Redirect::route('profile')->with('success', 'Account successfully updated');
|
||||
return redirect()->route('profile')->with('success', 'Account successfully updated');
|
||||
}
|
||||
return Redirect::back()->withInput()->withErrors($user->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($user->getErrors());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ class ReportsController extends Controller
|
||||
|
||||
return $response;
|
||||
} else {
|
||||
return Redirect::to("reports/custom")
|
||||
return redirect()->to("reports/custom")
|
||||
->with('error', trans('admin/reports/message.error'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ class SettingsController extends Controller
|
||||
$settings->user_id = 1;
|
||||
|
||||
if ((!$user->isValid('initial')) && (!$settings->isValid('initial'))) {
|
||||
return Redirect::back()->withInput()->withErrors($user->getErrors())->withErrors($settings->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($user->getErrors())->withErrors($settings->getErrors());
|
||||
} else {
|
||||
$user->save();
|
||||
$settings->save();
|
||||
@@ -291,7 +291,7 @@ class SettingsController extends Controller
|
||||
// Check if the asset exists
|
||||
if (is_null($setting = Setting::find(1))) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin')->with('error', trans('admin/settings/message.update.error'));
|
||||
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
|
||||
}
|
||||
|
||||
if (Input::get('clear_logo')=='1') {
|
||||
@@ -393,15 +393,15 @@ class SettingsController extends Controller
|
||||
|
||||
// If validation fails, we'll exit the operation now.
|
||||
if ($setting->save()) {
|
||||
return Redirect::to("admin/settings/app")->with('success', trans('admin/settings/message.update.success'));
|
||||
return redirect()->to("admin/settings/app")->with('success', trans('admin/settings/message.update.success'));
|
||||
|
||||
} else {
|
||||
return Redirect::back()->withInput()->withErrors($setting->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($setting->getErrors());
|
||||
}
|
||||
|
||||
|
||||
// Redirect to the setting management page
|
||||
return Redirect::to("admin/settings/app/edit")->with('error', trans('admin/settings/message.update.error'));
|
||||
return redirect()->to("admin/settings/app/edit")->with('error', trans('admin/settings/message.update.error'));
|
||||
|
||||
}
|
||||
|
||||
@@ -455,10 +455,10 @@ class SettingsController extends Controller
|
||||
{
|
||||
if (!config('app.lock_passwords')) {
|
||||
Artisan::call('backup:run');
|
||||
return Redirect::to("admin/settings/backups")->with('success', trans('admin/settings/message.backup.generated'));
|
||||
return redirect()->to("admin/settings/backups")->with('success', trans('admin/settings/message.backup.generated'));
|
||||
} else {
|
||||
|
||||
return Redirect::to("admin/settings/backups")->with('error', trans('general.feature_disabled'));
|
||||
return redirect()->to("admin/settings/backups")->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
|
||||
|
||||
@@ -482,11 +482,11 @@ class SettingsController extends Controller
|
||||
} else {
|
||||
|
||||
// Redirect to the backup page
|
||||
return Redirect::route('settings/backups')->with('error', trans('admin/settings/message.backup.file_not_found'));
|
||||
return redirect()->route('settings/backups')->with('error', trans('admin/settings/message.backup.file_not_found'));
|
||||
}
|
||||
} else {
|
||||
// Redirect to the backup page
|
||||
return Redirect::route('settings/backups')->with('error', trans('general.feature_disabled'));
|
||||
return redirect()->route('settings/backups')->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
|
||||
|
||||
@@ -507,12 +507,12 @@ class SettingsController extends Controller
|
||||
$file = config('backup::path').'/'.$filename;
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
return Redirect::route('settings/backups')->with('success', trans('admin/settings/message.backup.file_deleted'));
|
||||
return redirect()->route('settings/backups')->with('success', trans('admin/settings/message.backup.file_deleted'));
|
||||
} else {
|
||||
return Redirect::route('settings/backups')->with('error', trans('admin/settings/message.backup.file_not_found'));
|
||||
return redirect()->route('settings/backups')->with('error', trans('admin/settings/message.backup.file_not_found'));
|
||||
}
|
||||
} else {
|
||||
return Redirect::route('settings/backups')->with('error', trans('general.feature_disabled'));
|
||||
return redirect()->route('settings/backups')->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -534,11 +534,11 @@ class SettingsController extends Controller
|
||||
return View::make('settings/purge')
|
||||
->with('output', $output)->with('success', trans('admin/settings/message.purge.success'));
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('admin/settings/message.purge.validation_failed'));
|
||||
return redirect()->back()->with('error', trans('admin/settings/message.purge.validation_failed'));
|
||||
}
|
||||
|
||||
} else {
|
||||
return Redirect::back()->with('error', trans('general.feature_disabled'));
|
||||
return redirect()->back()->with('error', trans('general.feature_disabled'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ class StatuslabelsController extends Controller
|
||||
// Was the asset created?
|
||||
if ($statuslabel->save()) {
|
||||
// Redirect to the new Statuslabel page
|
||||
return Redirect::to("admin/settings/statuslabels")->with('success', trans('admin/statuslabels/message.create.success'));
|
||||
return redirect()->to("admin/settings/statuslabels")->with('success', trans('admin/statuslabels/message.create.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($statuslabel->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($statuslabel->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class StatuslabelsController extends Controller
|
||||
// Check if the Statuslabel exists
|
||||
if (is_null($statuslabel = Statuslabel::find($statuslabelId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.does_not_exist'));
|
||||
}
|
||||
|
||||
$use_statuslabel_type = $statuslabel->getStatuslabelType();
|
||||
@@ -148,7 +148,7 @@ class StatuslabelsController extends Controller
|
||||
// Check if the Statuslabel exists
|
||||
if (is_null($statuslabel = Statuslabel::find($statuslabelId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.does_not_exist'));
|
||||
}
|
||||
|
||||
|
||||
@@ -164,14 +164,14 @@ class StatuslabelsController extends Controller
|
||||
// Was the asset created?
|
||||
if ($statuslabel->save()) {
|
||||
// Redirect to the saved Statuslabel page
|
||||
return Redirect::to("admin/settings/statuslabels/")->with('success', trans('admin/statuslabels/message.update.success'));
|
||||
return redirect()->to("admin/settings/statuslabels/")->with('success', trans('admin/statuslabels/message.update.success'));
|
||||
} else {
|
||||
return Redirect::back()->withInput()->withErrors($statuslabel->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($statuslabel->getErrors());
|
||||
}
|
||||
|
||||
|
||||
// Redirect to the Statuslabel management page
|
||||
return Redirect::to("admin/settings/statuslabels/$statuslabelId/edit")->with('error', trans('admin/statuslabels/message.update.error'));
|
||||
return redirect()->to("admin/settings/statuslabels/$statuslabelId/edit")->with('error', trans('admin/statuslabels/message.update.error'));
|
||||
|
||||
}
|
||||
|
||||
@@ -186,20 +186,20 @@ class StatuslabelsController extends Controller
|
||||
// Check if the Statuslabel exists
|
||||
if (is_null($statuslabel = Statuslabel::find($statuslabelId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.not_found'));
|
||||
return redirect()->to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.not_found'));
|
||||
}
|
||||
|
||||
|
||||
if ($statuslabel->has_assets() > 0) {
|
||||
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.assoc_users'));
|
||||
return redirect()->to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.assoc_users'));
|
||||
} else {
|
||||
|
||||
$statuslabel->delete();
|
||||
|
||||
// Redirect to the statuslabels management page
|
||||
return Redirect::to('admin/settings/statuslabels')->with('success', trans('admin/statuslabels/message.delete.success'));
|
||||
return redirect()->to('admin/settings/statuslabels')->with('success', trans('admin/statuslabels/message.delete.success'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -94,11 +94,11 @@ class SuppliersController extends Controller
|
||||
// Was it created?
|
||||
if ($supplier->save()) {
|
||||
// Redirect to the new supplier page
|
||||
return Redirect::to("admin/settings/suppliers")->with('success', trans('admin/suppliers/message.create.success'));
|
||||
return redirect()->to("admin/settings/suppliers")->with('success', trans('admin/suppliers/message.create.success'));
|
||||
}
|
||||
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($supplier->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($supplier->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class SuppliersController extends Controller
|
||||
// Check if the supplier exists
|
||||
if (is_null($supplier = Supplier::find($supplierId))) {
|
||||
// Redirect to the supplier page
|
||||
return Redirect::to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
@@ -145,7 +145,7 @@ class SuppliersController extends Controller
|
||||
// Check if the supplier exists
|
||||
if (is_null($supplier = Supplier::find($supplierId))) {
|
||||
// Redirect to the supplier page
|
||||
return Redirect::to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.does_not_exist'));
|
||||
return redirect()->to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Save the data
|
||||
@@ -179,10 +179,10 @@ class SuppliersController extends Controller
|
||||
}
|
||||
|
||||
if ($supplier->save()) {
|
||||
return Redirect::to("admin/settings/suppliers")->with('success', trans('admin/suppliers/message.update.success'));
|
||||
return redirect()->to("admin/settings/suppliers")->with('success', trans('admin/suppliers/message.update.success'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($supplier->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($supplier->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -197,20 +197,20 @@ class SuppliersController extends Controller
|
||||
// Check if the supplier exists
|
||||
if (is_null($supplier = Supplier::find($supplierId))) {
|
||||
// Redirect to the suppliers page
|
||||
return Redirect::to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.not_found'));
|
||||
return redirect()->to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.not_found'));
|
||||
}
|
||||
|
||||
if ($supplier->num_assets() > 0) {
|
||||
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.assoc_users'));
|
||||
return redirect()->to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.assoc_users'));
|
||||
} else {
|
||||
|
||||
// Delete the supplier
|
||||
$supplier->delete();
|
||||
|
||||
// Redirect to the suppliers management page
|
||||
return Redirect::to('admin/settings/suppliers')->with('success', trans('admin/suppliers/message.delete.success'));
|
||||
return redirect()->to('admin/settings/suppliers')->with('success', trans('admin/suppliers/message.delete.success'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -233,7 +233,7 @@ class SuppliersController extends Controller
|
||||
$error = trans('admin/suppliers/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('suppliers')->with('error', $error);
|
||||
return redirect()->route('suppliers')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -125,10 +125,10 @@ class UsersController extends Controller
|
||||
}
|
||||
return redirect::route('users')->with('success', trans('admin/users/message.success.create'));
|
||||
} else {
|
||||
Redirect::back()->withInput()->withInput()->withErrors($user->getErrors())->withErrors($settings->getErrors());
|
||||
redirect()->back()->withInput()->withInput()->withErrors($user->getErrors())->withErrors($settings->getErrors());
|
||||
}
|
||||
|
||||
return Redirect::route('create/user')->withInput()->with('error', $error);
|
||||
return redirect()->route('create/user')->withInput()->with('error', $error);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,7 +187,7 @@ class UsersController extends Controller
|
||||
$user = User::find($id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get this user groups
|
||||
@@ -219,7 +219,7 @@ class UsersController extends Controller
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
|
||||
// Show the page
|
||||
@@ -247,7 +247,7 @@ class UsersController extends Controller
|
||||
|
||||
// Only update the email address if locking is set to false
|
||||
if (config('app.lock_passwords')) {
|
||||
return Redirect::route('users')->with('error', 'Denied! You cannot update user information on the demo.');
|
||||
return redirect()->route('users')->with('error', 'Denied! You cannot update user information on the demo.');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -255,14 +255,14 @@ class UsersController extends Controller
|
||||
$user = User::find($id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
} catch (UserNotFoundException $e) {
|
||||
// Prepare the error message
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
@@ -311,10 +311,10 @@ class UsersController extends Controller
|
||||
$success = trans('admin/users/message.success.update');
|
||||
|
||||
// Redirect to the user page
|
||||
return Redirect::route('users')->with('success', $success);
|
||||
return redirect()->route('users')->with('success', $success);
|
||||
}
|
||||
|
||||
return Redirect::back()->withInput()->withErrors($user->getErrors());
|
||||
return redirect()->back()->withInput()->withErrors($user->getErrors());
|
||||
|
||||
}
|
||||
|
||||
@@ -338,32 +338,32 @@ class UsersController extends Controller
|
||||
$error = trans('admin/users/message.error.delete');
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
// Do we have permission to delete this user?
|
||||
if ((!Auth::user()->isSuperUser()) || (config('app.lock_passwords'))) {
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', 'Insufficient permissions!');
|
||||
return redirect()->route('users')->with('error', 'Insufficient permissions!');
|
||||
}
|
||||
|
||||
if (count($user->assets) > 0) {
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', 'This user still has ' . count($user->assets) . ' assets associated with them.');
|
||||
return redirect()->route('users')->with('error', 'This user still has ' . count($user->assets) . ' assets associated with them.');
|
||||
}
|
||||
|
||||
if (count($user->licenses) > 0) {
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', 'This user still has ' . count($user->licenses) . ' licenses associated with them.');
|
||||
return redirect()->route('users')->with('error', 'This user still has ' . count($user->licenses) . ' licenses associated with them.');
|
||||
}
|
||||
|
||||
if (count($user->accessories) > 0) {
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', 'This user still has ' . count($user->accessories) . ' accessories associated with them.');
|
||||
return redirect()->route('users')->with('error', 'This user still has ' . count($user->accessories) . ' accessories associated with them.');
|
||||
}
|
||||
|
||||
// Delete the user
|
||||
@@ -373,13 +373,13 @@ class UsersController extends Controller
|
||||
$success = trans('admin/users/message.success.delete');
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('success', $success);
|
||||
return redirect()->route('users')->with('success', $success);
|
||||
} catch (UserNotFoundException $e) {
|
||||
// Prepare the error message
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ class UsersController extends Controller
|
||||
{
|
||||
|
||||
if ((!Input::has('edit_user')) || (count(Input::has('edit_user')) == 0)) {
|
||||
return Redirect::back()->with('error', 'No users selected');
|
||||
return redirect()->back()->with('error', 'No users selected');
|
||||
} else {
|
||||
$statuslabel_list = Helper::statusLabelList();
|
||||
$user_raw_array = array_keys(Input::get('edit_user'));
|
||||
@@ -417,9 +417,9 @@ class UsersController extends Controller
|
||||
{
|
||||
|
||||
if ((!Input::has('edit_user')) || (count(Input::has('edit_user')) == 0)) {
|
||||
return Redirect::back()->with('error', 'No users selected');
|
||||
return redirect()->back()->with('error', 'No users selected');
|
||||
} elseif ((!Input::has('status_id')) || (count(Input::has('status_id')) == 0)) {
|
||||
return Redirect::route('users')->with('error', 'No status selected');
|
||||
return redirect()->route('users')->with('error', 'No status selected');
|
||||
} else {
|
||||
|
||||
$user_raw_array = Input::get('edit_user');
|
||||
@@ -430,7 +430,7 @@ class UsersController extends Controller
|
||||
}
|
||||
|
||||
if (!Auth::user()->isSuperUser()) {
|
||||
return Redirect::route('users')->with('error', trans('admin/users/message.insufficient_permissions'));
|
||||
return redirect()->route('users')->with('error', trans('admin/users/message.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (!config('app.lock_passwords')) {
|
||||
@@ -481,13 +481,13 @@ class UsersController extends Controller
|
||||
}
|
||||
|
||||
|
||||
return Redirect::route('users')->with('success', 'Your selected users have been deleted and their assets have been updated.');
|
||||
return redirect()->route('users')->with('success', 'Your selected users have been deleted and their assets have been updated.');
|
||||
} else {
|
||||
return Redirect::route('users')->with('error', 'Bulk delete is not enabled in this installation');
|
||||
return redirect()->route('users')->with('error', 'Bulk delete is not enabled in this installation');
|
||||
}
|
||||
|
||||
/** @noinspection PhpUnreachableStatementInspection Known to be unreachable but kept following discussion: https://github.com/snipe/snipe-it/pull/1423 */
|
||||
return Redirect::route('users')->with('error', 'An error has occurred');
|
||||
return redirect()->route('users')->with('error', 'An error has occurred');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,18 +504,18 @@ class UsersController extends Controller
|
||||
|
||||
// Get user information
|
||||
if (!$user = User::onlyTrashed()->find($id)) {
|
||||
return Redirect::route('users')->with('error', trans('admin/users/messages.user_not_found'));
|
||||
return redirect()->route('users')->with('error', trans('admin/users/messages.user_not_found'));
|
||||
}
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
|
||||
// Restore the user
|
||||
if (User::withTrashed()->where('id',$id)->restore()) {
|
||||
return Redirect::route('users')->with('success', trans('admin/users/message.success.restored'));
|
||||
return redirect()->route('users')->with('success', trans('admin/users/message.success.restored'));
|
||||
} else {
|
||||
return Redirect::route('users')->with('error','User could not be restored.');
|
||||
return redirect()->route('users')->with('error','User could not be restored.');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -540,7 +540,7 @@ class UsersController extends Controller
|
||||
if (isset($user->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('users/view', compact('user', 'userlog'));
|
||||
}
|
||||
@@ -549,7 +549,7 @@ class UsersController extends Controller
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,26 +573,26 @@ class UsersController extends Controller
|
||||
$error = trans('admin/users/message.error.unsuspend');
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
|
||||
// Do we have permission to unsuspend this user?
|
||||
if ($user->isSuperUser() and ! Auth::user()->isSuperUser()) {
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', 'Insufficient permissions!');
|
||||
return redirect()->route('users')->with('error', 'Insufficient permissions!');
|
||||
}
|
||||
|
||||
// Prepare the success message
|
||||
$success = trans('admin/users/message.success.unsuspend');
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('success', $success);
|
||||
return redirect()->route('users')->with('success', $success);
|
||||
} catch (UserNotFoundException $e) {
|
||||
// Prepare the error message
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,7 +661,7 @@ class UsersController extends Controller
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -792,7 +792,7 @@ class UsersController extends Controller
|
||||
});
|
||||
|
||||
|
||||
return Redirect::route('users')->with('duplicates', $duplicates)->with('success', 'Success');
|
||||
return redirect()->route('users')->with('duplicates', $duplicates)->with('success', 'Success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -938,7 +938,7 @@ class UsersController extends Controller
|
||||
if (isset($user->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
foreach (Input::file('file') as $file) {
|
||||
@@ -987,7 +987,7 @@ class UsersController extends Controller
|
||||
if (isset($user->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
$log = Actionlog::find($fileId);
|
||||
$full_filename = $destinationPath . '/' . $log->filename;
|
||||
@@ -995,14 +995,14 @@ class UsersController extends Controller
|
||||
unlink($destinationPath . '/' . $log->filename);
|
||||
}
|
||||
$log->delete();
|
||||
return Redirect::back()->with('success', trans('admin/users/message.deletefile.success'));
|
||||
return redirect()->back()->with('success', trans('admin/users/message.deletefile.success'));
|
||||
}
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = trans('admin/users/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the licence management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1023,7 +1023,7 @@ class UsersController extends Controller
|
||||
// the license is valid
|
||||
if (isset($user->id)) {
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('users')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
$log = Actionlog::find($fileId);
|
||||
$file = $log->get_src();
|
||||
@@ -1034,7 +1034,7 @@ class UsersController extends Controller
|
||||
$error = trans('admin/users/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the licence management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1127,13 +1127,13 @@ class UsersController extends Controller
|
||||
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
|
||||
|
||||
if (!$ldapconn) {
|
||||
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_connect'));
|
||||
return redirect()->route('users')->with('error', trans('admin/users/message.error.ldap_could_not_connect'));
|
||||
}
|
||||
|
||||
// Set options
|
||||
$ldapopt = @ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, $ldap_version);
|
||||
if (!$ldapopt) {
|
||||
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_connect'));
|
||||
return redirect()->route('users')->with('error', trans('admin/users/message.error.ldap_could_not_connect'));
|
||||
}
|
||||
|
||||
// Binding to ldap server
|
||||
@@ -1141,7 +1141,7 @@ class UsersController extends Controller
|
||||
|
||||
Log::error(ldap_errno($ldapconn));
|
||||
if (!$ldapbind) {
|
||||
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_bind').ldap_error($ldapconn));
|
||||
return redirect()->route('users')->with('error', trans('admin/users/message.error.ldap_could_not_bind').ldap_error($ldapconn));
|
||||
}
|
||||
|
||||
// Set up LDAP pagination for very large databases
|
||||
@@ -1159,13 +1159,13 @@ class UsersController extends Controller
|
||||
$search_results = ldap_search($ldapconn, $base_dn, '('.$filter.')');
|
||||
|
||||
if (!$search_results) {
|
||||
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn));
|
||||
return redirect()->route('users')->with('error', trans('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn));
|
||||
}
|
||||
|
||||
// Get results from page
|
||||
$results = ldap_get_entries($ldapconn, $search_results);
|
||||
if (!$results) {
|
||||
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_get_entries').ldap_error($ldapconn));
|
||||
return redirect()->route('users')->with('error', trans('admin/users/message.error.ldap_could_not_get_entries').ldap_error($ldapconn));
|
||||
}
|
||||
|
||||
// Add results to result set
|
||||
@@ -1239,7 +1239,7 @@ class UsersController extends Controller
|
||||
|
||||
|
||||
|
||||
return Redirect::route('ldap/user')->with('success', "OK")->with('summary', $summary);
|
||||
return redirect()->route('ldap/user')->with('success', "OK")->with('summary', $summary);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,7 +49,7 @@ class ViewAssetsController extends Controller
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
return redirect()->route('users')->with('error', $error);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,9 +72,9 @@ class ViewAssetsController extends Controller
|
||||
// Check if the asset exists and is requestable
|
||||
if (is_null($asset = Asset::RequestableAssets()->find($assetId))) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::route('requestable-assets')->with('error', trans('admin/hardware/message.does_not_exist_or_not_requestable'));
|
||||
return redirect()->route('requestable-assets')->with('error', trans('admin/hardware/message.does_not_exist_or_not_requestable'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return Redirect::route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
|
||||
$logaction = new Actionlog();
|
||||
@@ -130,7 +130,7 @@ class ViewAssetsController extends Controller
|
||||
|
||||
}
|
||||
|
||||
return Redirect::route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));
|
||||
return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));
|
||||
}
|
||||
|
||||
|
||||
@@ -144,13 +144,13 @@ class ViewAssetsController extends Controller
|
||||
|
||||
if (is_null($findlog = Actionlog::find($logID))) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('account')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
return redirect()->to('account')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user->id != $findlog->checkedout_to) {
|
||||
return Redirect::to('account/view-assets')->with('error', trans('admin/users/message.error.incorrect_user_accepted'));
|
||||
return redirect()->to('account/view-assets')->with('error', trans('admin/users/message.error.incorrect_user_accepted'));
|
||||
}
|
||||
|
||||
// Asset
|
||||
@@ -168,9 +168,9 @@ class ViewAssetsController extends Controller
|
||||
// Check if the asset exists
|
||||
if (is_null($item)) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('account')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
return redirect()->to('account')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($item)) {
|
||||
return Redirect::route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('account/accept-asset', compact('item'))->with('findlog', $findlog);
|
||||
}
|
||||
@@ -183,28 +183,28 @@ class ViewAssetsController extends Controller
|
||||
// Check if the asset exists
|
||||
if (is_null($findlog = Actionlog::find($logID))) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('account/view-assets')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
return redirect()->to('account/view-assets')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// NOTE: make sure the global scope is applied
|
||||
$is_unauthorized = is_null(Actionlog::where('id', '=', $logID)->first());
|
||||
if ($is_unauthorized) {
|
||||
return Redirect::route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if ($findlog->accepted_id!='') {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('account/view-assets')->with('error', trans('admin/users/message.error.asset_already_accepted'));
|
||||
return redirect()->to('account/view-assets')->with('error', trans('admin/users/message.error.asset_already_accepted'));
|
||||
}
|
||||
|
||||
if (!Input::has('asset_acceptance')) {
|
||||
return Redirect::to('account/view-assets')->with('error', trans('admin/users/message.error.accept_or_decline'));
|
||||
return redirect()->to('account/view-assets')->with('error', trans('admin/users/message.error.accept_or_decline'));
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user->id != $findlog->checkedout_to) {
|
||||
return Redirect::to('account/view-assets')->with('error', trans('admin/users/message.error.incorrect_user_accepted'));
|
||||
return redirect()->to('account/view-assets')->with('error', trans('admin/users/message.error.incorrect_user_accepted'));
|
||||
}
|
||||
|
||||
$logaction = new Actionlog();
|
||||
@@ -261,10 +261,10 @@ class ViewAssetsController extends Controller
|
||||
$affected_asset->save();
|
||||
|
||||
if ($update_checkout) {
|
||||
return Redirect::to('account/view-assets')->with('success', $return_msg);
|
||||
return redirect()->to('account/view-assets')->with('success', $return_msg);
|
||||
|
||||
} else {
|
||||
return Redirect::to('account/view-assets')->with('error', 'Something went wrong ');
|
||||
return redirect()->to('account/view-assets')->with('error', 'Something went wrong ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user