mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
This commit is contained in:
parent
a369a111e0
commit
e67b3e474f
|
@ -38,7 +38,7 @@ class AccessoriesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getIndex(Request $request)
|
||||
public function index(Request $request)
|
||||
{
|
||||
return View::make('accessories/index');
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class AccessoriesController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @return View
|
||||
*/
|
||||
public function getCreate(Request $request)
|
||||
public function create(Request $request)
|
||||
{
|
||||
// Show the page
|
||||
return View::make('accessories/edit')
|
||||
|
@ -68,7 +68,7 @@ class AccessoriesController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postCreate(Request $request)
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
// create a new model instance
|
||||
|
@ -103,7 +103,7 @@ class AccessoriesController extends Controller
|
|||
if ($accessory->save()) {
|
||||
$accessory->logCreate();
|
||||
// Redirect to the new accessory page
|
||||
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.create.success'));
|
||||
return redirect()->route('accessories.index')->with('success', trans('admin/accessories/message.create.success'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,14 +117,14 @@ class AccessoriesController extends Controller
|
|||
* @param int $accessoryId
|
||||
* @return View
|
||||
*/
|
||||
public function getEdit(Request $request, $accessoryId = null)
|
||||
public function edit(Request $request, $accessoryId = null)
|
||||
{
|
||||
// Check if the accessory exists
|
||||
if (is_null($item = 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()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($item)) {
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('accessories.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
return View::make('accessories/edit', compact('item'))
|
||||
|
@ -142,14 +142,14 @@ class AccessoriesController extends Controller
|
|||
* @param int $accessoryId
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postEdit(Request $request, $accessoryId = null)
|
||||
public function update(Request $request, $accessoryId = null)
|
||||
{
|
||||
// Check if the accessory exists
|
||||
if (is_null($accessory = Accessory::find($accessoryId))) {
|
||||
// Redirect to the accessory index page
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
return redirect()->route('accessories.index')->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()->route('accessories.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Update the accessory data
|
||||
|
@ -184,7 +184,7 @@ class AccessoriesController extends Controller
|
|||
// Was the accessory updated?
|
||||
if ($accessory->save()) {
|
||||
// Redirect to the updated accessory page
|
||||
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.update.success'));
|
||||
return redirect()->route('accessories.index')->with('success', trans('admin/accessories/message.update.success'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,24 +199,24 @@ class AccessoriesController extends Controller
|
|||
* @param int $accessoryId
|
||||
* @return Redirect
|
||||
*/
|
||||
public function getDelete(Request $request, $accessoryId)
|
||||
public function destroy(Request $request, $accessoryId)
|
||||
{
|
||||
// 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()->route('accessories.index')->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()->route('accessories.index')->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()->route('accessories.index')->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()->route('accessories.index')->with('success', trans('admin/accessories/message.delete.success'));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -233,14 +233,14 @@ class AccessoriesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getView(Request $request, $accessoryID = null)
|
||||
public function show(Request $request, $accessoryID = null)
|
||||
{
|
||||
$accessory = Accessory::find($accessoryID);
|
||||
|
||||
if (isset($accessory->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('accessories.index')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('accessories/view', compact('accessory'));
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ class AccessoriesController extends Controller
|
|||
// Redirect to the accessory management page with error
|
||||
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()->route('accessories.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
|
@ -296,11 +296,11 @@ class AccessoriesController extends Controller
|
|||
// Redirect to the accessory management page with error
|
||||
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()->route('accessories.index')->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()->route('accessories.index')->with('error', trans('admin/accessories/message.not_found'));
|
||||
}
|
||||
|
||||
// Update the accessory data
|
||||
|
@ -374,7 +374,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()->route('accessories.index')->with('success', trans('admin/accessories/message.checkout.success'));
|
||||
|
||||
|
||||
|
||||
|
@ -393,13 +393,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()->route('accessories.index')->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()->route('accessories.index')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('accessories/checkin', compact('accessory'))->with('backto', $backto);
|
||||
}
|
||||
|
@ -419,14 +419,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()->route('accessories.index')->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()->route('accessories.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$return_to = e($accessory_user->assigned_to);
|
||||
|
@ -500,7 +500,7 @@ class AccessoriesController extends Controller
|
|||
}
|
||||
|
||||
// Redirect to the accessory management page with error
|
||||
return redirect()->to("admin/accessories")->with('error', trans('admin/accessories/message.checkin.error'));
|
||||
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.checkin.error'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -583,11 +583,11 @@ class AccessoriesController extends Controller
|
|||
$accessory->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($accessory->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
if (Gate::allows('accessories.edit')) {
|
||||
$actions .= '<a href="' . route('update/accessory',
|
||||
$actions .= '<a href="' . route('accessories.update',
|
||||
$accessory->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('accessories.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/accessory',
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('accessories.destroy',
|
||||
$accessory->id) . '" data-content="' . trans('admin/accessories/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($accessory->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
$actions .= '</nobr>';
|
||||
|
|
|
@ -71,7 +71,7 @@ class AssetsController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getIndex()
|
||||
public function index()
|
||||
{
|
||||
return View::make('hardware/index');
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class AssetsController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getCreate($model_id = null)
|
||||
public function create($model_id = null)
|
||||
{
|
||||
// Grab the dropdown lists
|
||||
$model_list = Helper::modelList();
|
||||
|
@ -144,7 +144,7 @@ class AssetsController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postCreate(AssetRequest $request)
|
||||
public function store(AssetRequest $request)
|
||||
{
|
||||
// create a new model instance
|
||||
$asset = new Asset();
|
||||
|
@ -286,7 +286,7 @@ class AssetsController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getEdit($assetId = null)
|
||||
public function edit($assetId = null)
|
||||
{
|
||||
|
||||
// Check if the asset exists
|
||||
|
@ -712,7 +712,7 @@ class AssetsController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getView($assetId = null)
|
||||
public function show($assetId = null)
|
||||
{
|
||||
$asset = Asset::withTrashed()->find($assetId);
|
||||
$settings = Setting::getSettings();
|
||||
|
@ -1761,11 +1761,11 @@ class AssetsController extends Controller
|
|||
$asset->id) . '" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i></a> ';
|
||||
}
|
||||
if (Gate::allows('assets.edit')) {
|
||||
$actions .= '<a href="' . route('update/hardware',
|
||||
$actions .= '<a href="' . route('hardware.edit',
|
||||
$asset->id) . '" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
}
|
||||
if (Gate::allows('assets.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/hardware',
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('hardware.destroy',
|
||||
$asset->id) . '" data-content="' . trans('admin/hardware/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($asset->asset_tag) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
} elseif ($asset->model->deleted_at=='') {
|
||||
|
|
|
@ -338,7 +338,7 @@ class CategoriesController extends Controller
|
|||
$inout='';
|
||||
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('hardware.edit', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
} elseif ($asset->deleted_at!='') {
|
||||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ class CategoriesController extends Controller
|
|||
$inout='';
|
||||
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('update/accessory', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/accessory', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('accessories.update', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('accessories.destroy', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
}
|
||||
|
||||
|
||||
|
@ -462,7 +462,7 @@ class CategoriesController extends Controller
|
|||
$inout='';
|
||||
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('update/consumable', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/consumable', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('consumables.edit', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('consumables.destroy', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class ConsumablesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getIndex()
|
||||
public function index()
|
||||
{
|
||||
return View::make('consumables/index');
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class ConsumablesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getCreate()
|
||||
public function create()
|
||||
{
|
||||
// Show the page
|
||||
$category_list = Helper::categoryList('consumable');
|
||||
|
@ -75,7 +75,7 @@ class ConsumablesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postCreate()
|
||||
public function store()
|
||||
{
|
||||
$consumable = new Consumable();
|
||||
$consumable->name = e(Input::get('name'));
|
||||
|
@ -107,7 +107,7 @@ class ConsumablesController extends Controller
|
|||
if ($consumable->save()) {
|
||||
$consumable->logCreate();
|
||||
// Redirect to the new consumable page
|
||||
return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.create.success'));
|
||||
return redirect()->route('consumables.index')->with('success', trans('admin/consumables/message.create.success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->withInput()->withErrors($consumable->getErrors());
|
||||
|
@ -124,14 +124,14 @@ class ConsumablesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getEdit($consumableId = null)
|
||||
public function edit($consumableId = null)
|
||||
{
|
||||
// Check if the consumable exists
|
||||
if (is_null($item = 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()->route('consumables.index')->with('error', trans('admin/consumables/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($item)) {
|
||||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('consumables.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = Helper::categoryList('consumable');
|
||||
|
@ -156,12 +156,12 @@ class ConsumablesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postEdit($consumableId = null)
|
||||
public function update($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()->route('consumables.index')->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()->route('consumables.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$consumable->name = e(Input::get('name'));
|
||||
|
@ -189,7 +189,7 @@ class ConsumablesController extends Controller
|
|||
$consumable->qty = Helper::ParseFloat(e(Input::get('qty')));
|
||||
|
||||
if ($consumable->save()) {
|
||||
return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.update.success'));
|
||||
return redirect()->route('consumables.index')->with('success', trans('admin/consumables/message.update.success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->withInput()->withErrors($consumable->getErrors());
|
||||
|
@ -204,20 +204,20 @@ class ConsumablesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function getDelete($consumableId)
|
||||
public function destroy($consumableId)
|
||||
{
|
||||
// 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()->route('consumables.index')->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()->route('consumables.index')->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()->route('consumables.index')->with('success', trans('admin/consumables/message.delete.success'));
|
||||
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ class ConsumablesController extends Controller
|
|||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('consumables.index')->with('error', trans('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('consumables/view', compact('consumable'));
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ class ConsumablesController extends Controller
|
|||
// Redirect to the consumable management page with error
|
||||
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()->route('consumables.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
|
@ -297,7 +297,7 @@ class ConsumablesController extends Controller
|
|||
// Redirect to the consumable management page with error
|
||||
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()->route('consumables.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$admin_user = Auth::user();
|
||||
|
@ -306,7 +306,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()->route('consumables.index')->with('error', trans('admin/consumables/message.user_does_not_exist'));
|
||||
}
|
||||
|
||||
// Update the consumable data
|
||||
|
@ -372,7 +372,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()->route('consumables.index')->with('success', trans('admin/consumables/message.checkout.success'));
|
||||
|
||||
|
||||
|
||||
|
@ -447,11 +447,11 @@ class ConsumablesController extends Controller
|
|||
}
|
||||
|
||||
if (Gate::allows('consumables.edit')) {
|
||||
$actions .= '<a href="' . route('update/consumable',
|
||||
$actions .= '<a href="' . route('consumables.edit',
|
||||
$consumable->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('consumables.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/consumable',
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('consumables.destroy',
|
||||
$consumable->id) . '" data-content="' . trans('admin/consumables/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($consumable->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class CustomFieldsController extends Controller
|
|||
* @since [v1.8]
|
||||
* @return View
|
||||
*/
|
||||
public function getIndex()
|
||||
public function index()
|
||||
{
|
||||
|
||||
$fieldsets = CustomFieldset::with("fields", "models")->get();
|
||||
|
|
|
@ -43,7 +43,7 @@ class LicensesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getIndex()
|
||||
public function index()
|
||||
{
|
||||
// Show the page
|
||||
return View::make('licenses/index');
|
||||
|
@ -58,7 +58,7 @@ class LicensesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getCreate()
|
||||
public function create()
|
||||
{
|
||||
|
||||
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
|
||||
|
@ -84,7 +84,7 @@ class LicensesController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postCreate()
|
||||
public function store()
|
||||
{
|
||||
|
||||
// create a new model instance
|
||||
|
@ -188,14 +188,14 @@ class LicensesController extends Controller
|
|||
* @param int $licenseId
|
||||
* @return View
|
||||
*/
|
||||
public function getEdit($licenseId = null)
|
||||
public function edit($licenseId = null)
|
||||
{
|
||||
// Check if the license exists
|
||||
if (is_null($item = 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()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($item)) {
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if ($item->purchase_date == "0000-00-00") {
|
||||
|
@ -230,14 +230,14 @@ class LicensesController extends Controller
|
|||
* @param int $licenseId
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postEdit($licenseId = null)
|
||||
public function update($licenseId = null)
|
||||
{
|
||||
// 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()->route('licenses.index')->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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Update the license data
|
||||
|
@ -386,20 +386,20 @@ class LicensesController extends Controller
|
|||
* @param int $licenseId
|
||||
* @return Redirect
|
||||
*/
|
||||
public function getDelete($licenseId)
|
||||
public function destroy($licenseId)
|
||||
{
|
||||
// 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()->route('licenses.index')->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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if ($license->assigned_seats_count > 0) {
|
||||
|
||||
// Redirect to the license management page
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.assoc_users'));
|
||||
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.assoc_users'));
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -416,7 +416,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()->route('licenses.index')->with('success', trans('admin/licenses/message.delete.success'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,9 +439,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()->route('licenses.index')->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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
|
@ -474,7 +474,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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Declare the rules for the form validation
|
||||
|
@ -497,7 +497,7 @@ class LicensesController extends Controller
|
|||
// 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()->route('licenses.index')->with('error', trans('admin/licenses/message.user_does_not_exist'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -505,12 +505,12 @@ class LicensesController extends Controller
|
|||
|
||||
if (is_null($asset = 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()->route('licenses.index')->with('error', trans('admin/licenses/message.asset_does_not_exist'));
|
||||
}
|
||||
|
||||
|
||||
if (($asset->assigned_to!='') && (($asset->assigned_to!=$assigned_to)) && ($assigned_to!='')) {
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.owner_doesnt_match_asset'));
|
||||
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.owner_doesnt_match_asset'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -520,7 +520,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()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found'));
|
||||
}
|
||||
|
||||
if (Input::get('asset_id') == '') {
|
||||
|
@ -616,9 +616,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()->route('licenses.index')->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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
return View::make('licenses/checkin', compact('licenseseat'))->with('backto', $backto);
|
||||
|
||||
|
@ -641,13 +641,13 @@ 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()->route('licenses.index')->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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (!$license->reassignable) {
|
||||
|
@ -750,7 +750,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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
return View::make('licenses/view', compact('license'));
|
||||
|
||||
|
@ -768,9 +768,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()->route('licenses.index')->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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
|
@ -817,7 +817,7 @@ class LicensesController extends Controller
|
|||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (Input::hasFile('licensefile')) {
|
||||
|
@ -885,7 +885,7 @@ class LicensesController extends Controller
|
|||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
|
||||
return redirect()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
|
@ -925,7 +925,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()->route('licenses.index')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
|
@ -1045,7 +1045,7 @@ 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()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found'));
|
||||
}
|
||||
$seatId = $license->freeSeat($licenseId);
|
||||
return redirect()->to('admin/licenses/'.$seatId.'/checkout');
|
||||
|
|
|
@ -307,7 +307,7 @@ class ManufacturersController extends Controller
|
|||
|
||||
$actions = '';
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('hardware.edit', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
} elseif ($asset->deleted_at!='') {
|
||||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
@ -437,11 +437,11 @@ class ManufacturersController extends Controller
|
|||
$accessory->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($accessory->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
if (Gate::allows('accessories.edit')) {
|
||||
$actions .= '<a href="' . route('update/accessory',
|
||||
$actions .= '<a href="' . route('accessories.update',
|
||||
$accessory->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('accessories.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/accessory',
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('accessories.destroy',
|
||||
$accessory->id) . '" data-content="' . trans('admin/accessories/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($accessory->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
$actions .= '</nobr>';
|
||||
|
@ -502,11 +502,11 @@ class ManufacturersController extends Controller
|
|||
}
|
||||
|
||||
if (Gate::allows('consumables.edit')) {
|
||||
$actions .= '<a href="' . route('update/consumable',
|
||||
$actions .= '<a href="' . route('consumables.edit',
|
||||
$consumable->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('consumables.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/consumable',
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('consumables.destroy',
|
||||
$consumable->id) . '" data-content="' . trans('admin/consumables/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($consumable->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue