<?php
namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\CustomBilling;
use App\Models\CustomBillingItem;

class InvoiceCustomController extends Controller
{
    public function index(Request $request)
    {
        $billings = CustomBilling::leftJoin('customers','customers.id','=','custom_billings.customer_id')
            ->select('custom_billings.*','customers.name','customers.phone','customers.email','customers.address')
            ->where('custom_billings.id',$request->billing_id)
            ->get();
            
        $billingItems = CustomBillingItem::where('billing_id',$request->billing_id)->get();

        return view('admin/invoice_custom',['billing'=>$billings[0],'billingItems'=>$billingItems,'title'=>'AR Clean Invoice']);
    }
}
?>