Home How to match two tables and insert it into another table in laravel 5.4?
 I need to match two tables and insert it into the disbursment table, so this is my code...  public function store(Request $request) { //Approved Request$approvedRequest= DB::table('request') ->where('users_MemId',Auth::user()->MemId) ->where('requestStatus','Approved') ->join('requestdetails','request.requestId','=','requestdetails.request_requestId') ->join('itemattribute','requestdetails.RequestDetailsId','=','itemattribute.RequestDetailsId') ->join('exudeinventory', 'itemattribute.AttrName', '=', 'exudeinventory.ItemName') ->select('itemattribute.AttrName', 'exudeinventory.InventoryId', 'request.requestId') ->get(); // dd(\$approvedRequest);  store function. I've tried matching the tables and I can't figure out on how to insert the values in another table or if I am doing it right. I've been looking for solutions but still I can't figure it out, Hope that someone would help me and explain it to me, I am new to laravel T,T