checkoutable->logCheckin($event->checkedOutTo, $event->note, $event->action_date); } public function onCheckoutableCheckedOut(CheckoutableCheckedOut $event) { $event->checkoutable->logCheckout($event->note, $event->checkedOutTo, $event->checkoutable->last_checkout); } public function onCheckoutAccepted(CheckoutAccepted $event) { $logaction = new Actionlog(); $logaction->item()->associate($event->acceptance->checkoutable); $logaction->target()->associate($event->acceptance->assignedTo); $logaction->accept_signature = $event->acceptance->signature_filename; $logaction->stored_eula_file = $event->acceptance->stored_eula_file; $logaction->action_type = 'accepted'; // TODO: log the actual license seat that was checked out if ($event->acceptance->checkoutable instanceof LicenseSeat) { $logaction->item()->associate($event->acceptance->checkoutable->license); } $logaction->save(); } public function onCheckoutDeclined(CheckoutDeclined $event) { $logaction = new Actionlog(); $logaction->item()->associate($event->acceptance->checkoutable); $logaction->target()->associate($event->acceptance->assignedTo); $logaction->accept_signature = $event->acceptance->signature_filename; $logaction->action_type = 'declined'; // TODO: log the actual license seat that was checked out if ($event->acceptance->checkoutable instanceof LicenseSeat) { $logaction->item()->associate($event->acceptance->checkoutable->license); } $logaction->save(); } /** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $list = [ 'CheckoutableCheckedIn', 'CheckoutableCheckedOut', 'CheckoutAccepted', 'CheckoutDeclined', ]; foreach ($list as $event) { $events->listen( 'App\Events\\'.$event, 'App\Listeners\LogListener@on'.$event ); } } }