user3386779
user3386779

Reputation: 7175

join query for merging three tables in laravel

I want to join project table with department table based on department_string_id and join users table with project_owner_id in project table with users table aceid for the condition project.project_owner_id=users.aceid

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 query

 $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();

caught below error

TokenMismatchException in VerifyCsrfToken.php line 68:

What I did wrong here

Upvotes: 0

Views: 55

Answers (1)

Arshid KV
Arshid KV

Reputation: 10037

To avoid CSRF attack we want add token in form. Laravel token

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

Upvotes: 1

Related Questions