這是 home.blade.php 文件 @foreach($userview as $userview){ @if($userview = [{"role_code": "auv_recommend"}]){ <center> <div class="box"> <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" data-submenu aria-expanded="false">AUV</button> <div class="dropright dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(14px, 60px, 0px);"> <button class="dropdown-item" type="button"><a tabindex=" -1" href="create">CREATE</a></button> <button class="dropdown-item dropdown-toggle test1" type="button" data-toggle="dropdown">VIEW</button> <div class="dropdown-menu dropright"> <button class="dropdown-item" type="button"><a tabindex="-1" href="pendinglistSH">Awaiting Approval</a></button> <button class="dropdown-item" type="button"><a tabindex=" -1" href="reports">Reports</a></button> </div> </div> </div> </div> </center>}另外,如何在不返回數組的情況下僅獲取列值以便可以使用它來檢查我的狀況,我嘗試將變量 $userview 插入會話中,以便可以將其轉到另一個控制器并嘗試調用來自家庭控制器的變量,但它失敗了
1 回答

萬千封印
TA貢獻1891條經驗 獲得超3個贊
要回答您的第一個問題,您可以在負責為您的視圖提供服務的方法中獲取所需的數據。例如,如果這將是您的主頁,那將是index().
例子:
public function index(){
$userview = Session::get('userview');
// Example data
$yourData = DB::table('users')->where('name', 'John')->first();
// Pass an array as second argument to view to pass more data, or you
// can chain ->with calls
return view('greetings', ['userview' => $userview, 'yourdata' => $user]);
}
然后,您可以同時使用userview和yourdata在您的index視圖中。
- 1 回答
- 0 關注
- 142 瀏覽
添加回答
舉報
0/150
提交
取消