这里我想从数据库中获取价值。我在布局中使用它,我不想使用控制器来获取价值。它没有显示任何东西。我该如何解决?提前谢谢
info.blade.php
{{$data = \App\visitor::where('flag',1)->get()}}
@foreach ($data as $val)
Name {{ $val->v_name }} <br>
Mobile {{ $val->v_mobile }}
@endforeach
答案 0 :(得分:1)
即使不使用控制器也不是一个好主意,你可以这样做
def currency_converter(amount):
amount = int(100*amount)
hundred = (amount//10000)
amount -= hundred*10000
fifty = (amount//5000)
amount -= fifty*5000
ten = (amount//1000)
amount -= ten*1000
five = (amount//500)
amount -= five*500
one = (amount//100)
amount -= one*100
quarter = (amount//25)
amount -= quarter*25
dime = (amount//5)
amount -= dime*5
penny = amount
return (hundred, fifty, ten, five, one, quarter, dime,penny)