php - How To use Blade Directive in Component - Stack Overflow

admin2025-04-22  0

I Have a blade directive, register in AppServiceProvider, @rupiah

I want to use my directive in my laravel component.

<x-form.input name="NLTRX" label="Nilai Transaksi" disabled="true" value="{{ rupiah($retailPending['NLTRX']) }}" />

But its return error, Call to undefined function rupiah().

Any solutions?

I try using value="{{ rupiah($retailPending['NLTRX']) }}" :value=" rupiah($retailPending['NLTRX']) " :value="@rupiah($retailPending['NLTRX']) " It did'nt work either

I Have a blade directive, register in AppServiceProvider, @rupiah

I want to use my directive in my laravel component.

<x-form.input name="NLTRX" label="Nilai Transaksi" disabled="true" value="{{ rupiah($retailPending['NLTRX']) }}" />

But its return error, Call to undefined function rupiah().

Any solutions?

I try using value="{{ rupiah($retailPending['NLTRX']) }}" :value=" rupiah($retailPending['NLTRX']) " :value="@rupiah($retailPending['NLTRX']) " It did'nt work either

Share Improve this question asked Jan 31 at 7:50 Alvin FZAlvin FZ 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Instead of calling rupiah() in the attribute, you can use the directive inside the component.

Modify your Blade component template (form/input.blade.php):

<input type="text" name="{{ $name }}" value="@rupiah($value)" {{ $attributes }} />

Then, use the component like this:

<x-form.input name="NLTRX" label="Nilai Transaksi" disabled="true" :value="$retailPending['NLTRX']" />
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745275850a293864.html

最新回复(0)