51 lines
1.1 KiB
PHP
Raw Normal View History

2022-06-01 10:15:55 +03:00
<?php
namespace App\Abstracts\View\Components\Transfers;
use App\Abstracts\View\Component;
use App\Traits\ViewComponents;
2022-07-25 16:48:29 +03:00
use App\Utilities\Modules;
2022-06-01 10:15:55 +03:00
abstract class Template extends Component
{
use ViewComponents;
public $model;
public $transfer;
2022-07-25 16:48:29 +03:00
public array $payment_methods;
public string $template;
2022-06-01 10:15:55 +03:00
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
2022-07-25 16:48:29 +03:00
$model = false, $transfer = false, array $payment_methods = [], string $template = ''
2022-06-01 10:15:55 +03:00
) {
$this->model = $model;
$this->transfer = $this->getTransfer($model, $transfer);
2022-07-25 16:48:29 +03:00
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
2022-06-01 10:15:55 +03:00
$this->template = ! empty($template) ? $template : setting('transfer.template');
// Set Parent data
$this->setParentData();
}
protected function getTransfer($model, $transfer)
{
if (! empty($model)) {
return $model;
}
if (! empty($transfer)) {
return $transfer;
}
return false;
}
}