我想将项目表与基于Department_string_id的部门表联接,并将用户表与项目表中的条件表project.project_owner_id = users.aceid的用户表aceid联接到项目表中的project_owner_id

desired query (working fine)
 select p.*,d.department_head_aceid from project as p inner join department as d on p.department_string_id=d.department_string_id inner join users as u on p.project_owner_id=u.aceid where u.id='4'


Laravel查询

 $approver_id_roles=DB::table('project')
         ->join('department', 'project.department_string_id', '=', 'department.department_string_id')->join('users','project.project_owner_id','=','users.aceid')
         ->where('project.project_owner_id','=','users.aceid')
         ->select('department.department_head_aceid')->get();


捕获以下错误


  VerifyCsrfToken.php第68行中的TokenMismatchException:


我在这里做错了

最佳答案

为了避免CSRF攻击,我们希望以形式添加令牌。
Laravel token

<input type="hidden" name="_token" value="{{ csrf_token() }}">

关于php - 连接查询以合并laravel中的三个表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46578290/

10-11 12:52