gpt4 book ai didi

mysql - 将 Controller 在 Blade 文件中获取的值传递给查询

转载 作者:行者123 更新时间:2023-11-29 18:22:36 39 4
gpt4 key购买 nike

我已将 Blade 文件中的 Controller 值获取为 {{ $user->user_name }}。我想传递该值以在同一 Blade 文件中进行查询。

sample.blade.php
{{$user->user_name}}

$test=db::table('department')->where('department.parent_department','=','{{ $user->user_name }}')->get();

最佳答案

你可以像这样使用它,不需要花括号。

$test=DB::table('department')->where('department.parent_department','=',$user->user_name)->get();

关于mysql - 将 Controller 在 Blade 文件中获取的值传递给查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46445006/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com