diff --git a/app/Http/Controllers/DepreciationsController.php b/app/Http/Controllers/DepreciationsController.php index f64ae1a117..22d0c86c71 100755 --- a/app/Http/Controllers/DepreciationsController.php +++ b/app/Http/Controllers/DepreciationsController.php @@ -28,7 +28,7 @@ class DepreciationsController extends Controller * @since [v1.0] * @return View */ - public function getIndex() + public function index() { // Show the page return View::make('depreciations/index', compact('depreciations')); @@ -43,7 +43,7 @@ class DepreciationsController extends Controller * @since [v1.0] * @return View */ - public function getCreate() + public function create() { // Show the page return View::make('depreciations/edit')->with('item', new Depreciation); @@ -58,7 +58,7 @@ class DepreciationsController extends Controller * @since [v1.0] * @return Redirect */ - public function postCreate(Request $request) + public function store(Request $request) { // get the POST data @@ -91,12 +91,12 @@ class DepreciationsController extends Controller * @since [v1.0] * @return View */ - public function getEdit($depreciationId = null) + public function edit($depreciationId = null) { // Check if the depreciation exists if (is_null($item = 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()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist')); } return View::make('depreciations/edit', compact('item')); @@ -112,12 +112,12 @@ class DepreciationsController extends Controller * @since [v1.0] * @return Redirect */ - public function postEdit(Request $request, $depreciationId = null) + public function update(Request $request, $depreciationId = null) { // 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()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist')); } // Depreciation data @@ -144,24 +144,24 @@ class DepreciationsController extends Controller * @since [v1.0] * @return Redirect */ - public function getDelete($depreciationId) + public function destroy($depreciationId) { // 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()->route('depreciations.index')->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()->route('depreciations.index')->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()->route('depreciations.index')->with('success', trans('admin/depreciations/message.delete.success')); } } @@ -208,7 +208,7 @@ class DepreciationsController extends Controller $rows = array(); foreach ($depreciations as $depreciation) { - $actions = ''; + $actions = ''; $rows[] = array( 'id' => $depreciation->id, diff --git a/app/Http/Controllers/ManufacturersController.php b/app/Http/Controllers/ManufacturersController.php index 7152e4ad02..aeaf4fdd9f 100755 --- a/app/Http/Controllers/ManufacturersController.php +++ b/app/Http/Controllers/ManufacturersController.php @@ -11,6 +11,7 @@ use Lang; use Redirect; use Str; use View; +use Illuminate\Http\Request; /** * This controller handles all actions related to Manufacturers for @@ -29,7 +30,7 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getIndex() + public function index() { // Show the page return View::make('manufacturers/index', compact('manufacturers')); @@ -44,7 +45,7 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getCreate() + public function create() { return View::make('manufacturers/edit')->with('item', new Manufacturer); } @@ -58,10 +59,10 @@ class ManufacturersController extends Controller * @since [v1.0] * @return Redirect */ - public function postCreate() + public function store(Request $request) { $manufacturer = new Manufacturer; - $manufacturer->name = e(Input::get('name')); + $manufacturer->name = e($request->input('name')); $manufacturer->user_id = Auth::user()->id; if ($manufacturer->save()) { @@ -81,12 +82,12 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getEdit($manufacturerId = null) + public function edit($manufacturerId = null) { // Check if the manufacturer exists if (is_null($item = 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()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist')); } // Show the page @@ -103,16 +104,16 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function postEdit($manufacturerId = null) + public function update(Request $request, $manufacturerId = null) { // 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()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist')); } // Save the data - $manufacturer->name = e(Input::get('name')); + $manufacturer->name = e($request->input('name')); // Was it created? if ($manufacturer->save()) { @@ -133,25 +134,25 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getDelete($manufacturerId) + public function destroy($manufacturerId) { // 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()->route('manufacturers.index')->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()->route('manufacturers.index')->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()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.delete.success')); } } @@ -169,7 +170,7 @@ class ManufacturersController extends Controller * @since [v1.0] * @return View */ - public function getView($manufacturerId = null) + public function show($manufacturerId = null) { $manufacturer = Manufacturer::find($manufacturerId); @@ -194,30 +195,30 @@ class ManufacturersController extends Controller * @since [v1.0] * @return String JSON */ - public function getDatatable() + public function getDatatable(Request $request) { $manufacturers = Manufacturer::select(array('id','name'))->with('assets') ->whereNull('deleted_at'); - if (Input::has('search')) { - $manufacturers = $manufacturers->TextSearch(e(Input::get('search'))); + if ($request->has('search')) { + $manufacturers = $manufacturers->TextSearch(e($request->input('search'))); } - if (Input::has('offset')) { - $offset = e(Input::get('offset')); + if ($request->has('offset')) { + $offset = e($request->input('offset')); } else { $offset = 0; } - if (Input::has('limit')) { - $limit = e(Input::get('limit')); + if ($request->has('limit')) { + $limit = e($request->input('limit')); } else { $limit = 50; } $allowed_columns = ['id','name']; - $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; + $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; + $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; $manufacturers->orderBy($sort, $order); @@ -227,11 +228,11 @@ class ManufacturersController extends Controller $rows = array(); foreach ($manufacturers as $manufacturer) { - $actions = ''; + $actions = ''; $rows[] = array( 'id' => $manufacturer->id, - 'name' => (string)link_to('admin/settings/manufacturers/'.$manufacturer->id.'/view', e($manufacturer->name)), + 'name' => (string)link_to_route('manufacturers.show', e($manufacturer->name),['manufacturer' => $manufacturer->id]), 'assets' => $manufacturer->assets->count(), 'actions' => $actions ); @@ -279,26 +280,26 @@ class ManufacturersController extends Controller $manufacturer = $manufacturer->load('assets.model', 'assets.assigneduser', 'assets.assetstatus', 'assets.company'); $manufacturer_assets = $manufacturer->assets; - if (Input::has('search')) { - $manufacturer_assets = $manufacturer_assets->TextSearch(e(Input::get('search'))); + if ($request->has('search')) { + $manufacturer_assets = $manufacturer_assets->TextSearch(e($request->input('search'))); } - if (Input::has('offset')) { - $offset = e(Input::get('offset')); + if ($request->has('offset')) { + $offset = e($request->input('offset')); } else { $offset = 0; } - if (Input::has('limit')) { - $limit = e(Input::get('limit')); + if ($request->has('limit')) { + $limit = e($request->input('limit')); } else { $limit = 50; } - $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; + $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $allowed_columns = ['id','name','serial','asset_tag']; - $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; + $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; $count = $manufacturer_assets->count(); $rows = array(); @@ -348,8 +349,8 @@ class ManufacturersController extends Controller $manufacturer = $manufacturer->load('licenses.company', 'licenses.manufacturer', 'licenses.licenseSeatsRelation'); $licenses = $manufacturer->licenses; - if (Input::has('search')) { - $licenses = $licenses->TextSearch(Input::get('search')); + if ($request->has('search')) { + $licenses = $licenses->TextSearch($request->input('search')); } $licenseCount = $licenses->count(); @@ -415,12 +416,12 @@ class ManufacturersController extends Controller ); $accessories = $manufacturer->accessories; - if (Input::has('search')) { - $accessories = $accessories->TextSearch(e(Input::get('search'))); + if ($request->has('search')) { + $accessories = $accessories->TextSearch(e($request->input('search'))); } - if (Input::has('limit')) { - $limit = e(Input::get('limit')); + if ($request->has('limit')) { + $limit = e($request->input('limit')); } else { $limit = 50; } @@ -480,12 +481,12 @@ class ManufacturersController extends Controller ); $consumables = $manufacturer->consumables; - if (Input::has('search')) { - $consumables = $consumables->TextSearch(e(Input::get('search'))); + if ($request->has('search')) { + $consumables = $consumables->TextSearch(e($request->input('search'))); } - if (Input::has('limit')) { - $limit = e(Input::get('limit')); + if ($request->has('limit')) { + $limit = e($request->input('limit')); } else { $limit = 50; } diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 2d920accfb..67f33272c9 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -353,7 +353,7 @@ class ReportsController extends Controller } if (($activity->item) && ($activity->itemType()=="asset")) { - $activity_item = ''.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).''; + $activity_item = ''.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).''; $item_type = 'asset'; } elseif ($activity->item) { $activity_item = 'target_id).'">'.$activity->user->fullName().''; } elseif ($activity->target_type === "App\Models\Asset") { if($activity->target) { - $activity_target = ''.$activity->target->showAssetName().''; + $activity_target = ''.$activity->target->showAssetName().''; } else { $activity_target = ""; } diff --git a/app/Http/Controllers/StatuslabelsController.php b/app/Http/Controllers/StatuslabelsController.php index 08a3df65fe..52c40e8e5e 100755 --- a/app/Http/Controllers/StatuslabelsController.php +++ b/app/Http/Controllers/StatuslabelsController.php @@ -30,7 +30,7 @@ class StatuslabelsController extends Controller * @return View */ - public function getIndex() + public function index() { // Show the page return View::make('statuslabels/index', compact('statuslabels')); @@ -84,7 +84,7 @@ class StatuslabelsController extends Controller * * @return View */ - public function getCreate() + public function create() { // Show the page $item = new Statuslabel; @@ -100,7 +100,7 @@ class StatuslabelsController extends Controller * * @return Redirect */ - public function postCreate(Request $request) + public function store(Request $request) { // create a new model instance @@ -133,7 +133,7 @@ class StatuslabelsController extends Controller } - public function store(Request $request) + public function apiStore(Request $request) { $statuslabel = new Statuslabel(); @@ -166,7 +166,7 @@ class StatuslabelsController extends Controller * @param int $statuslabelId * @return View */ - public function getEdit($statuslabelId = null) + public function edit($statuslabelId = null) { // Check if the Statuslabel exists if (is_null($item = Statuslabel::find($statuslabelId))) { @@ -188,7 +188,7 @@ class StatuslabelsController extends Controller * @param int $statuslabelId * @return Redirect */ - public function postEdit(Request $request, $statuslabelId = null) + public function update(Request $request, $statuslabelId = null) { // Check if the Statuslabel exists if (is_null($statuslabel = Statuslabel::find($statuslabelId))) { @@ -232,7 +232,7 @@ class StatuslabelsController extends Controller * @param int $statuslabelId * @return Redirect */ - public function getDelete($statuslabelId) + public function destroy($statuslabelId) { // Check if the Statuslabel exists if (is_null($statuslabel = Statuslabel::find($statuslabelId))) { @@ -302,7 +302,7 @@ class StatuslabelsController extends Controller $label_type = trans('admin/statuslabels/table.undeployable'); } - $actions = ''; + $actions = ''; if ($statuslabel->color!='') { $color = '
'.e($statuslabel->color); diff --git a/app/Http/Controllers/SuppliersController.php b/app/Http/Controllers/SuppliersController.php index d6114c2b05..babb64b96d 100755 --- a/app/Http/Controllers/SuppliersController.php +++ b/app/Http/Controllers/SuppliersController.php @@ -28,7 +28,7 @@ class SuppliersController extends Controller * * @return View */ - public function getIndex() + public function index() { // Grab all the suppliers $suppliers = Supplier::orderBy('created_at', 'DESC')->get(); @@ -43,7 +43,7 @@ class SuppliersController extends Controller * * @return View */ - public function getCreate() + public function create() { return View::make('suppliers/edit')->with('item', new Supplier); } @@ -54,7 +54,7 @@ class SuppliersController extends Controller * * @return Redirect */ - public function postCreate() + public function store() { // get the POST data @@ -103,7 +103,7 @@ class SuppliersController extends Controller } - public function store(Request $request) + public function apiStore(Request $request) { $supplier = new Supplier; $supplier->name = e($request->input('name')); @@ -122,12 +122,12 @@ class SuppliersController extends Controller * @param int $supplierId * @return View */ - public function getEdit($supplierId = null) + public function edit($supplierId = null) { // Check if the supplier exists if (is_null($item = 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()->route('suppliers.index')->with('error', trans('admin/suppliers/message.does_not_exist')); } // Show the page @@ -141,12 +141,12 @@ class SuppliersController extends Controller * @param int $supplierId * @return Redirect */ - public function postEdit($supplierId = null) + public function update($supplierId = null) { // 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()->route('suppliers.index')->with('error', trans('admin/suppliers/message.does_not_exist')); } // Save the data @@ -193,25 +193,25 @@ class SuppliersController extends Controller * @param int $supplierId * @return Redirect */ - public function getDelete($supplierId) + public function destroy($supplierId) { // 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()->route('suppliers.index')->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()->route('suppliers.index')->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()->route('suppliers.index')->with('success', trans('admin/suppliers/message.delete.success')); } } @@ -223,7 +223,7 @@ class SuppliersController extends Controller * @param int $assetId * @return View **/ - public function getView($supplierId = null) + public function show($supplierId = null) { $supplier = Supplier::find($supplierId); @@ -273,11 +273,11 @@ class SuppliersController extends Controller $rows = array(); foreach ($suppliers as $supplier) { - $actions = ''; + $actions = ''; $rows[] = array( 'id' => $supplier->id, - 'name' => (string)link_to('admin/settings/suppliers/'.$supplier->id.'/view', e($supplier->name)), + 'name' => (string)link_to_route('suppliers.show', e($supplier->name), ['supplier' => $supplier->id ]), 'contact' => e($supplier->contact), 'address' => e($supplier->address).' '.e($supplier->address2).' '.e($supplier->city).' '.e($supplier->state).' '.e($supplier->country), 'phone' => e($supplier->phone), diff --git a/app/Http/Controllers/ViewAssetsController.php b/app/Http/Controllers/ViewAssetsController.php index d7cf2e5296..680efacbf3 100755 --- a/app/Http/Controllers/ViewAssetsController.php +++ b/app/Http/Controllers/ViewAssetsController.php @@ -108,7 +108,7 @@ class ViewAssetsController extends Controller $data['item_type'] = $itemType; if ($fullItemType == Asset::class) { - $data['item_url'] = route('view/hardware', $item->id); + $data['item_url'] = route('hardware.show', $item->id); $slackMessage = ' Asset <'.url('/').'/hardware/'.$item->id.'/view'.'|'.$item->showAssetName().'> requested by <'.url('/').'/users/'.$item->user_id.'/view'.'|'.$user->fullName().'>.'; } else { $data['item_url'] = route("view/${itemType}", $item->id); diff --git a/resources/views/asset_maintenances/view.blade.php b/resources/views/asset_maintenances/view.blade.php index 33b5419947..f13402c0cc 100644 --- a/resources/views/asset_maintenances/view.blade.php +++ b/resources/views/asset_maintenances/view.blade.php @@ -47,7 +47,7 @@ use Carbon\Carbon;