fixed payment method in transfer show

This commit is contained in:
Denis Duliçi 2022-07-25 16:48:29 +03:00
parent 9fad0657e9
commit cc8ca2a740
2 changed files with 12 additions and 4 deletions

View File

@ -4,6 +4,7 @@ namespace App\Abstracts\View\Components\Transfers;
use App\Abstracts\View\Component; use App\Abstracts\View\Component;
use App\Traits\ViewComponents; use App\Traits\ViewComponents;
use App\Utilities\Modules;
abstract class Show extends Component abstract class Show extends Component
{ {
@ -13,7 +14,9 @@ abstract class Show extends Component
public $transfer; public $transfer;
public $template; public array $payment_methods;
public string $template;
/** /**
* Create a new component instance. * Create a new component instance.
@ -21,10 +24,11 @@ abstract class Show extends Component
* @return void * @return void
*/ */
public function __construct( public function __construct(
$model = false, $transfer = false, string $template = '' $model = false, $transfer = false, array $payment_methods = [], string $template = ''
) { ) {
$this->model = $model; $this->model = $model;
$this->transfer = $this->getTransfer($model, $transfer); $this->transfer = $this->getTransfer($model, $transfer);
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
$this->template = ! empty($template) ? $template : setting('transfer.template'); $this->template = ! empty($template) ? $template : setting('transfer.template');
// Set Parent data // Set Parent data

View File

@ -4,6 +4,7 @@ namespace App\Abstracts\View\Components\Transfers;
use App\Abstracts\View\Component; use App\Abstracts\View\Component;
use App\Traits\ViewComponents; use App\Traits\ViewComponents;
use App\Utilities\Modules;
abstract class Template extends Component abstract class Template extends Component
{ {
@ -13,7 +14,9 @@ abstract class Template extends Component
public $transfer; public $transfer;
public $template; public array $payment_methods;
public string $template;
/** /**
* Create a new component instance. * Create a new component instance.
@ -21,10 +24,11 @@ abstract class Template extends Component
* @return void * @return void
*/ */
public function __construct( public function __construct(
$model = false, $transfer = false, string $template = '' $model = false, $transfer = false, array $payment_methods = [], string $template = ''
) { ) {
$this->model = $model; $this->model = $model;
$this->transfer = $this->getTransfer($model, $transfer); $this->transfer = $this->getTransfer($model, $transfer);
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
$this->template = ! empty($template) ? $template : setting('transfer.template'); $this->template = ! empty($template) ? $template : setting('transfer.template');
// Set Parent data // Set Parent data