CaiWuXiTong/app/Http/ViewComposers/DocumentRecurring.php
WuYongJie 9595267ee7
Some checks failed
Tests / PHP 8.1 (push) Has been cancelled
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
chore: 导入 Akaunting 初始源码与团队协作规则
2026-07-20 18:20:25 +08:00

41 lines
814 B
PHP

<?php
namespace App\Http\ViewComposers;
use Illuminate\View\View;
use Illuminate\Support\Str;
class DocumentRecurring
{
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$route = request()->route();
if (empty($route)) {
return;
}
/** @var Invoices|Bills|PortalInvoices $controller */
$controller = $route->getController();
$type = $controller->type ?? '';
if (! Str::contains($type, 'recurring')) {
return;
}
$view->with([
'type' => $type,
]);
// Override the whole file
$view->setPath(view('components.documents.form.recurring_metadata', compact('type'))->getPath());
}
}