选择列数据与另一个表列匹配的数据

时间:2020-09-16 06:43:26

标签: laravel-7

我要获取category_table的数据,其中company_id等于select_companies的表的pan_code列

public function index(){
     $user = Auth::user()->id;
     $company = DB::select('select pan_code from select_companies where user_id = ?', [$user]);
     $datas = DB::select('select * from categories where company_id = ?', [$company]);
     return view('Category.category')->with('datas', $datas)->with('company', $company);
}

0 个答案:

没有答案