Offline Payment re-factoring
This commit is contained in:
29
modules/OfflinePayment/Listeners/OfflinePaymentAdminMenu.php
Normal file
29
modules/OfflinePayment/Listeners/OfflinePaymentAdminMenu.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayment\Listeners;
|
||||
|
||||
use Auth;
|
||||
use App\Events\AdminMenuCreated;
|
||||
|
||||
class OfflinePaymentAdminMenu
|
||||
{
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param AdminMenuCreated $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(AdminMenuCreated $event)
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
// Settings
|
||||
if ($user->can(['read-settings-settings', 'read-settings-categories', 'read-settings-currencies', 'read-settings-taxes'])) {
|
||||
// Add child to existing item
|
||||
$item = $event->menu->whereTitle(trans_choice('general.settings', 2));
|
||||
|
||||
$item->url('apps/offlinepayment/settings', trans('offlinepayment::general.title'), 4, ['icon' => 'fa fa-angle-double-right']);
|
||||
}
|
||||
}
|
||||
}
|
19
modules/OfflinePayment/Listeners/OfflinePaymentGateway.php
Normal file
19
modules/OfflinePayment/Listeners/OfflinePaymentGateway.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayment\Listeners;
|
||||
|
||||
use App\Events\PaymentGatewayListing;
|
||||
|
||||
class OfflinePaymentGateway
|
||||
{
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param PaymentGatewayListing $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(PaymentGatewayListing $event)
|
||||
{
|
||||
return json_decode(setting('offlinepayment.methods'), true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user