57 lines
1.2 KiB
PHP
Raw Normal View History

2021-06-24 13:52:49 +03:00
<?php
namespace App\View\Components\Transactions;
2022-06-01 10:15:55 +03:00
use App\Abstracts\View\Component;
use App\Traits\ViewComponents;
2021-06-24 13:52:49 +03:00
class Script extends Component
{
2022-06-01 10:15:55 +03:00
use ViewComponents;
public const OBJECT_TYPE = 'transaction';
public const DEFAULT_TYPE = 'income';
public const DEFAULT_PLURAL_TYPE = 'incomes';
2021-06-24 13:52:49 +03:00
/** @var string */
public $type;
2022-06-01 10:15:55 +03:00
public $transaction;
2021-06-24 13:52:49 +03:00
/** @var string */
2022-06-01 10:15:55 +03:00
public $alias;
2021-06-24 13:52:49 +03:00
/** @var string */
2022-06-01 10:15:55 +03:00
public $folder;
2021-06-24 13:52:49 +03:00
2022-06-01 10:15:55 +03:00
/** @var string */
public $file;
2021-06-24 13:52:49 +03:00
/**
* Create a new component instance.
*
* @return void
*/
2022-06-01 10:15:55 +03:00
public function __construct(
string $type = '', $transaction = false,
string $alias = '', string $folder = '', string $file = ''
) {
2021-06-24 13:52:49 +03:00
$this->type = $type;
$this->transaction = $transaction;
2022-06-01 10:15:55 +03:00
$this->alias = $this->getAlias($type, $alias);
$this->folder = $this->getScriptFolder($type, $folder);
$this->file = $this->getScriptFile($type, $file);
2021-06-24 13:52:49 +03:00
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('components.transactions.script');
}
}