diff --git a/app/Http/Controllers/References/SiteOptionsController.php b/app/Http/Controllers/References/SiteOptionsController.php index b7bd970..41b1926 100755 --- a/app/Http/Controllers/References/SiteOptionsController.php +++ b/app/Http/Controllers/References/SiteOptionsController.php @@ -2,8 +2,8 @@ namespace App\Http\Controllers\References; +use Option; use Illuminate\Http\Request; -use App\Entities\Options\Option; use App\Http\Controllers\Controller; /** @@ -20,15 +20,15 @@ class SiteOptionsController extends Controller public function save1(Request $request) { - $request->validate([ - 'money_sign' => 'required|max:3', + $optionData = $request->validate([ + 'money_sign' => 'required|max:3', + 'money_sign_in_word' => 'required|max:15', ]); - $option = Option::firstorNew(['key' => 'money_sign']); - $option->value = $request->get('money_sign'); - $option->save(); + Option::set('money_sign', $optionData['money_sign']); + Option::set('money_sign_in_word', $optionData['money_sign_in_word']); - flash(trans('option.updated'), 'success'); + flash(__('option.updated'), 'success'); return redirect()->route('site-options.page-1'); } diff --git a/resources/lang/de/option.php b/resources/lang/de/option.php index c1550b6..d2d0549 100644 --- a/resources/lang/de/option.php +++ b/resources/lang/de/option.php @@ -13,5 +13,6 @@ return [ 'value' => 'Wert', // Keys - 'money_sign' => 'Geldsignatur', + 'money_sign' => 'Geldsignatur', + 'money_sign_in_word' => 'Money Sign in Word', ]; diff --git a/resources/lang/en/option.php b/resources/lang/en/option.php index a24d83d..1002348 100644 --- a/resources/lang/en/option.php +++ b/resources/lang/en/option.php @@ -13,5 +13,6 @@ return [ 'value' => 'Value', // Keys - 'money_sign' => 'Money Sign', + 'money_sign' => 'Money Sign', + 'money_sign_in_word' => 'Money Sign in Word', ]; diff --git a/resources/lang/id/option.php b/resources/lang/id/option.php index c673dc6..d3dd95d 100644 --- a/resources/lang/id/option.php +++ b/resources/lang/id/option.php @@ -13,5 +13,6 @@ return [ 'value' => 'Value', // Keys - 'money_sign' => 'Tanda Mata Uang', + 'money_sign' => 'Tanda Mata Uang', + 'money_sign_in_word' => 'Tanda Mata Uang Terbilang', ]; diff --git a/resources/views/invoices/pdf.blade.php b/resources/views/invoices/pdf.blade.php index 984ce6d..51d6de9 100755 --- a/resources/views/invoices/pdf.blade.php +++ b/resources/views/invoices/pdf.blade.php @@ -142,7 +142,7 @@ {{ trans('payment.words_amount') }} : - {{ ucwords(Terbilang::make($invoice->amount)) }} Rupiah + {{ ucwords(Terbilang::make($invoice->amount)) }} {{ Option::get('money_sign_in_word', 'Rupiah') }} @if ($invoice->notes) diff --git a/resources/views/options/page-1.blade.php b/resources/views/options/page-1.blade.php index 84b7d26..6d0a1b8 100755 --- a/resources/views/options/page-1.blade.php +++ b/resources/views/options/page-1.blade.php @@ -22,6 +22,19 @@ + {{ trans('option.money_sign_in_word') }} + + {{ Form::text( + 'money_sign_in_word', + Option::get('money_sign_in_word', 'Rupiah'), + ['class' => 'form-control', 'maxlength' => 15] + ) }} + + Money sign in word like :
One Hundred {{ Option::get('money_sign_in_word', 'Rupiah') }}. +
+ + + {{ Form::submit(trans('app.update'), ['class' => 'btn btn-warning']) }} diff --git a/tests/Feature/References/SiteOptionsTest.php b/tests/Feature/References/SiteOptionsTest.php index 89f2ae8..948bb13 100644 --- a/tests/Feature/References/SiteOptionsTest.php +++ b/tests/Feature/References/SiteOptionsTest.php @@ -26,7 +26,8 @@ class SiteOptionsTest extends TestCase $this->visit(route('site-options.page-1')); $this->submitForm(trans('app.update'), [ - 'money_sign' => '$', + 'money_sign' => '$', + 'money_sign_in_word' => 'Dollars', ]); $this->see(trans('option.updated')); @@ -36,5 +37,10 @@ class SiteOptionsTest extends TestCase 'key' => 'money_sign', 'value' => '$', ]); + + $this->seeInDatabase('site_options', [ + 'key' => 'money_sign_in_word', + 'value' => 'Dollars', + ]); } }