diff --git a/app/Events/CheckoutableCheckedIn.php b/app/Events/CheckoutableCheckedIn.php index 2edb6888c..54e3db6ab 100644 --- a/app/Events/CheckoutableCheckedIn.php +++ b/app/Events/CheckoutableCheckedIn.php @@ -21,12 +21,12 @@ class CheckoutableCheckedIn * * @return void */ - public function __construct($checkoutable, $checkedOutTo, User $checkedInBy, $note, $action_date) + public function __construct($checkoutable, $checkedOutTo, User $checkedInBy, $note, $action_date = null) { $this->checkoutable = $checkoutable; $this->checkedOutTo = $checkedOutTo; $this->checkedInBy = $checkedInBy; $this->note = $note; - $this->action_date = $action_date; + $this->action_date = $action_date ?? date('Y-m-d'); } } diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index 3985e2089..2a3d004d1 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -245,10 +245,12 @@ class LicensesController extends Controller $offset = (($seats) && (request('offset') > $seats->count())) ? 0 : request('offset', 0); $limit = request('limit', 50); + $total = $seats->count(); + $seats = $seats->skip($offset)->take($limit)->get(); if ($seats) { - return (new LicenseSeatsTransformer)->transformLicenseSeats($seats, $seats->count()); + return (new LicenseSeatsTransformer)->transformLicenseSeats($seats, $total); } } diff --git a/app/Http/Controllers/Licenses/LicenseCheckinController.php b/app/Http/Controllers/Licenses/LicenseCheckinController.php index 768e69f4a..a5be968ca 100644 --- a/app/Http/Controllers/Licenses/LicenseCheckinController.php +++ b/app/Http/Controllers/Licenses/LicenseCheckinController.php @@ -69,8 +69,7 @@ class LicenseCheckinController extends Controller // Declare the rules for the form validation $rules = [ - 'note' => 'string', - 'notes' => 'string', + 'note' => 'string|nullable', ]; // Create a new validator instance from our validation rules diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index f278eb763..3194a90bb 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -417,7 +417,7 @@ @can('update', $license) - {{ trans('general.checkin') }} + {{ trans('general.checkin') }} @endcan diff --git a/routes/web/licenses.php b/routes/web/licenses.php index 44ed0f5ac..ce046c3a3 100644 --- a/routes/web/licenses.php +++ b/routes/web/licenses.php @@ -18,7 +18,7 @@ Route::group([ 'prefix' => 'licenses', 'middleware' => ['auth'] ], function () { '{licenseId}/checkout/{seatId?}', [ 'as' => 'licenses.checkout', 'uses' => 'Licenses\LicenseCheckoutController@store' ] ); - Route::get('{licenseId}/checkin/{backto?}', [ + Route::get('{licenseSeatId}/checkin/{backto?}', [ 'as' => 'licenses.checkin', 'uses' => 'Licenses\LicenseCheckinController@create' ]);