Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

What is the method of querying from two tables with a condition in Laravel

$query = Invoice_Details::query()-> with('invoice');
          
        
         if($request->invoice_type==1){

              $query->whereRelation('invoice','Invoice_type','=' ,1);
           }

    $Details = $query->get();

    return $Details -> sum('quantity');
 
PREVIOUS NEXT
Tagged: #What #method #querying #tables #condition #Laravel
ADD COMMENT
Topic
Name
9+8 =