akaunting/app/Http/ViewComposers/InvoiceText.php

45 lines
1.1 KiB
PHP
Raw Normal View History

2018-10-17 20:58:46 +03:00
<?php
namespace App\Http\ViewComposers;
use Illuminate\View\View;
class InvoiceText
{
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
2018-10-18 12:29:36 +03:00
$text_override = [];
2018-10-17 20:58:46 +03:00
2018-10-18 12:29:36 +03:00
$text_items = setting('general.invoice_item', trans_choice('general.items', 2));
2018-10-17 20:58:46 +03:00
if ($text_items == 'custom') {
$text_items = setting('general.invoice_item_input');
}
2018-10-18 12:29:36 +03:00
$text_quantity = setting('general.invoice_quantity', trans('invoices.quantity'));
2018-10-17 20:58:46 +03:00
if ($text_quantity == 'custom') {
$text_quantity = setting('general.invoice_quantity_input');
}
2018-10-18 12:29:36 +03:00
$text_price = setting('general.invoice_price', trans('invoices.price'));
2018-10-17 20:58:46 +03:00
if ($text_price == 'custom') {
$text_price = setting('general.invoice_price_input');
}
$text_override['items'] = $text_items;
$text_override['quantity'] = $text_quantity;
$text_override['price'] = $text_price;
$view->with(['text_override' => $text_override]);
}
}