Skip to content

A free open source IT asset/license management system

And still more license route updates

snipead1bf86a0844
diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php
index 736c92b90a..51090f992c 100755
--- a/app/Http/Controllers/LicensesController.php
+++ b/app/Http/Controllers/LicensesController.php
@@ -46,7 +46,6 @@ class LicensesController extends Controller
*/
public function index()
{
- // Show the page
return View::make('licenses/index');
}
@@ -848,7 +847,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.index')->with('error', $error);
}
}
@@ -888,7 +887,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.index')->with('error', $error);
}
}
@@ -923,7 +922,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.index')->with('error', $error);
}
}
@@ -975,7 +974,7 @@ class LicensesController extends Controller
$actions = '<span style="white-space: nowrap;">';
if (Gate::allows('licenses.checkout')) {
- $actions .= '<a href="' . route('freecheckout/license', $license->id)
+ $actions .= '<a href="' . route('licenses.freecheckout', $license->id)
. '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
}
@@ -1010,7 +1009,7 @@ class LicensesController extends Controller
'notes' => ($license->notes) ? e($license->notes) : '',
'actions' => $actions,
'company' => is_null($license->company) ? '' : e($license->company->name),
- 'manufacturer' => $license->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$license->manufacturer_id.'/view', $license->manufacturer->name) : ''
+ 'manufacturer' => $license->manufacturer ? (string) link_to('settings/manufacturers/'.$license->manufacturer_id.'/view', $license->manufacturer->name) : ''
);
}
@@ -1034,12 +1033,10 @@ class LicensesController extends Controller
*/
public function getFreeLicense($licenseId)
{
- // Check if the asset exists
if (is_null($license = License::find($licenseId))) {
- // Redirect to the asset management page with error
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found'));
}
$seatId = $license->freeSeat($licenseId);
- return redirect()->to('admin/licenses/'.$seatId.'/checkout');
+ return redirect()->route('licenses.checkout', $seatId);
}
}
diff --git a/app/Http/Controllers/ManufacturersController.php b/app/Http/Controllers/ManufacturersController.php
index 5691192207..7152e4ad02 100755
--- a/app/Http/Controllers/ManufacturersController.php
+++ b/app/Http/Controllers/ManufacturersController.php
@@ -360,7 +360,7 @@ class ManufacturersController extends Controller
$actions = '<span style="white-space: nowrap;">';
if (Gate::allows('licenses.checkout')) {
- $actions .= '<a href="' . route('freecheckout/license', $license->id)
+ $actions .= '<a href="' . route('licenses.freecheckout', $license->id)
. '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
}
diff --git a/resources/views/hardware/qr-view.blade.php b/resources/views/hardware/qr-view.blade.php
index 5bcbfddfad..f6b2396f35 100644
--- a/resources/views/hardware/qr-view.blade.php
+++ b/resources/views/hardware/qr-view.blade.php
@@ -177,7 +177,7 @@
<tr>
<td><a href="{{ route('view/license', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
<td>{{ $seat->license->serial }}</td>
- <td><a href="{{ route('checkin/license', $seat->id) }}" class="btn-flat info">{{ trans('general.checkin') }}</a>
+ <td><a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info">{{ trans('general.checkin') }}</a>
</td>
</tr>
@endforeach
diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php
index b3283be758..f57769712c 100755
--- a/resources/views/hardware/view.blade.php
+++ b/resources/views/hardware/view.blade.php
@@ -287,7 +287,7 @@
{{ trans('general.months') }}
)
@endif
-
+
</td>
</tr>
@endif
@@ -441,7 +441,7 @@
<td><a href="{{ route('view/license', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
<td>{{ $seat->license->serial }}</td>
<td>
- <a href="{{ route('checkin/license', $seat->id) }}" class="btn-flat info btn-sm">{{ trans('general.checkin') }}</a>
+ <a href="{{ route('licenses.checkin', $seat->id) }}" class="btn-flat info btn-sm">{{ trans('general.checkin') }}</a>
</td>
</tr>
@endforeach
@@ -489,7 +489,7 @@
{{ trans('general.no_results') }}
</div>
@endif
-
+
</div>
</div>
</div> <!-- /.tab-pane components -->
@@ -612,7 +612,7 @@
@else
<del>{{ $log->target->fullName() }}</del>
@endif
- @elseif($log->target instanceof \App\Models\Asset)
+ @elseif($log->target instanceof \App\Models\Asset)
@if ($log->target->deleted_at=='')
<a href="{{ route('view/hardware', $log->target_id) }}">
{{ $log->target->showAssetName() }}
diff --git a/resources/views/licenses/checkin.blade.php b/resources/views/licenses/checkin.blade.php
index 99659b915a..7c3ac3e93e 100755
--- a/resources/views/licenses/checkin.blade.php
+++ b/resources/views/licenses/checkin.blade.php
@@ -21,9 +21,9 @@
<div class="col-md-10 column">
@if ($backto=='user')
- <form class="form-horizontal" method="post" action="{{ route('checkin/license', array('licenseeat_id'=> $licenseseat->id, 'backto'=>'user')) }}" autocomplete="off">
+ <form class="form-horizontal" method="post" action="{{ route('licenses.checkin', array('licenseeat_id'=> $licenseseat->id, 'backto'=>'user')) }}" autocomplete="off">
@else
- <form class="form-horizontal" method="post" action="{{ route('checkin/license', $licenseseat->id) }}" autocomplete="off">
+ <form class="form-horizontal" method="post" action="{{ route('licenses.checkin', $licenseseat->id) }}" autocomplete="off">
@endif
<!-- CSRF Token -->
@@ -58,7 +58,7 @@
<div class="form-group">
<label class="col-md-2 control-label"></label>
<div class="col-md-7">
- <a class="btn btn-link" href="{{ route('licenses') }}">{{ trans('button.cancel') }}</a>
+ <a class="btn btn-link" href="{{ route('licenses.index') }}">{{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> {{ trans('general.checkin') }}</button>
</div>
</div>
diff --git a/resources/views/licenses/checkout.blade.php b/resources/views/licenses/checkout.blade.php
index 0c157e65e3..cd8e7896a9 100755
--- a/resources/views/licenses/checkout.blade.php
+++ b/resources/views/licenses/checkout.blade.php
@@ -88,7 +88,7 @@
</div>
</div>
<div class="box-footer">
- <a class="btn btn-link" href="{{ route('licenses') }}">{{ trans('button.cancel') }}</a>
+ <a class="btn btn-link" href="{{ route('licenses.index') }}">{{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkout') }}</button>
</div>
</form>
diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php
index 80670e043d..00ee42ba36 100755
--- a/resources/views/licenses/view.blade.php
+++ b/resources/views/licenses/view.blade.php
@@ -103,14 +103,14 @@
@if (($licensedto->assigned_to) || ($licensedto->asset_id))
@if ($license->reassignable)
- <a href="{{ route('checkin/license', $licensedto->id) }}" class="btn btn-primary btn-sm">
+ <a href="{{ route('licenses.checkin', $licensedto->id) }}" class="btn btn-primary btn-sm">
{{ trans('general.checkin') }}
</a>
@else
<span>Assigned</span>
@endif
@else
- <a href="{{ route('checkout/license', $licensedto->id) }}" class="btn btn-info btn-sm">
+ <a href="{{ route('licenses.checkout', $licensedto->id) }}" class="btn btn-info btn-sm">
{{ trans('general.checkout') }}</a>
@endif
@endcan
diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php
index 7fc9b87975..7e3e249f21 100755
--- a/resources/views/users/view.blade.php
+++ b/resources/views/users/view.blade.php
@@ -229,7 +229,7 @@
<td><a href="{{ route('view/license', $license->id) }}">{{ mb_strimwidth($license->serial, 0, 50, "...") }}</a></td>
<td class="hidden-print">
@can('licenses.edit')
- <a href="{{ route('checkin/license', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
+ <a href="{{ route('licenses.checkin', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
@endcan
</td>
</tr>
diff --git a/routes/web/licenses.php b/routes/web/licenses.php
index dd3424e0a5..9da04b5c75 100644
--- a/routes/web/licenses.php
+++ b/routes/web/licenses.php
@@ -8,37 +8,30 @@ Route::group([ 'prefix' => 'licenses', 'middleware'=>'authorize:licenses.view' ]
Route::post('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@postCreate' ]);
Route::get('{licenseId}/freecheckout', [
- 'as' => 'freecheckout/license',
+ 'as' => 'licenses.freecheckout',
'middleware' => 'authorize:licenses.checkout',
'uses' => 'LicensesController@getFreeLicense'
]);
Route::get(
'{licenseId}/checkout',
- [ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@getCheckout' ]
+ [ 'as' => 'licenses.checkout', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@getCheckout' ]
);
Route::post(
'{licenseId}/checkout',
- [ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@postCheckout' ]
+ [ 'as' => 'licenses.checkout', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@postCheckout' ]
);
Route::get('{licenseId}/checkin/{backto?}', [
- 'as' => 'checkin/license',
+ 'as' => 'licenses.checkin',
'middleware' => 'authorize:licenses.checkin',
'uses' => 'LicensesController@getCheckin'
]);
Route::post('{licenseId}/checkin/{backto?}', [
- 'as' => 'checkin/license',
+ 'as' => 'licenses.checkin',
'middleware' => 'authorize:licenses.checkin',
'uses' => 'LicensesController@postCheckin'
]);
- #legacy
- Route::get('{licenseId}/view', [
- 'as' => 'view/license',
- 'middleware' => 'authorize:licenses.view',
- 'uses' => 'LicensesController@getView'
- ]);
-
Route::post(
'{licenseId}/upload',
[ 'as' => 'upload/license', 'middleware' => 'authorize:licenses.edit','uses' => 'LicensesController@postUpload' ]