akaunting/app/Http/ViewComposers/InvoiceText.php

45 lines
1.0 KiB
PHP
Raw Normal View History

2018-10-17 17:58:46 +00: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 09:29:36 +00:00
$text_override = [];
2018-10-17 17:58:46 +00:00
2019-11-16 07:21:14 +00:00
$text_items = setting('invoice.item_name', 'general.items');
2018-10-17 17:58:46 +00:00
if ($text_items == 'custom') {
2019-11-16 07:21:14 +00:00
$text_items = setting('invoice.item_input');
2018-10-17 17:58:46 +00:00
}
2019-11-16 07:21:14 +00:00
$text_quantity = setting('invoice.quantity_name', 'invoices.quantity');
2018-10-17 17:58:46 +00:00
if ($text_quantity == 'custom') {
2019-11-16 07:21:14 +00:00
$text_quantity = setting('invoice.quantity_input');
2018-10-17 17:58:46 +00:00
}
2019-11-16 07:21:14 +00:00
$text_price = setting('invoice.price_name', 'invoices.price');
2018-10-17 17:58:46 +00:00
if ($text_price == 'custom') {
2019-11-16 07:21:14 +00:00
$text_price = setting('invoice.price_input');
2018-10-17 17:58:46 +00:00
}
$text_override['items'] = $text_items;
$text_override['quantity'] = $text_quantity;
$text_override['price'] = $text_price;
$view->with(['text_override' => $text_override]);
}
}