我觉得我会因为提出这个问题而自责,但我似乎无法弄明白。我想要做的是在刀片视图中计算集合的值并同时显示结果。这是我编写的简单代码
控制器
Sub MonthlyReset()
Dim TotalImpacts As Worksheet
Dim LastImpacts As Range
Dim Counter As String
'Set the worksheet we are working with
Set TotalImpacts = Worksheets("Total Impacts")
'Find the row that STOP is on
Counter = Application.WorksheetFunction.Match("STOP", TotalImpacts.Columns(1), 0)
'Set the range for the data we want to copy
Set LastImpacts = TotalImpacts.Rows("1:" & Counter)
'Copy and insert
LastImpacts.Copy
LastImpacts.Offset(Counter).Insert shift:=xlShiftDown
'Paste Values then Formatting
TotalImpacts.Range("A" & Counter + 1).PasteSpecial Paste:=xlPasteValues
TotalImpacts.Range("A" & Counter + 1).PasteSpecial Paste:=xlPasteFormats
'Clear Clipboard
Application.CutCopyMode = False
End Sub
我死后可以看到数据并转储$ pendingMembers。
刀片视图
$pendingMembers = Member::where('status', '=', null)->get();
然后返回<div class="mr-5">
{{ $pendingMembers->count() }} Pending
</div>
,那么我怎样才能达到预期的目标呢?
答案 0 :(得分:2)
将控制器方法中的变量与视图文件共享。
return view('your-blade-file', compact('pendingMembers'));
https://laravel.com/docs/5.5/views#passing-data-to-views上提供了更多详细信息。