Home How to match two tables and insert it into another table in laravel 5.4?
Reply: 0

How to match two tables and insert it into another table in laravel 5.4?

user1108
1#
user1108 Published in July 23, 2018, 1:38 pm

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

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.335993 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO