@extends('layouts.sidebar') @section('content') @php use App\Models\AccountChannel; // Get all AccountChannels with their related properties $accountChannels = AccountChannel::with('property')->where('account_id', request('account_number'))->get(); // Extract the property IDs safely from the related models $propertyIds = $accountChannels ->pluck('property') ->filter() // remove nulls ->pluck('id') // get the actual property IDs ->all(); $startDate = request('start_date'); $endDate = request('end_date'); @endphp

Electric Report

@php $queryParams = http_build_query([ 'property_id' => $propertyIds, 'start_date' => $startDate, 'end_date' => $endDate, ]); @endphp Electric Bill Statement
@php $properties = AccountChannel::with('property')->where('account_id', request('account_number'))->get(); @endphp

@foreach ($properties as $prop) {{ $prop->property->property_name ?? 'No Property' }}
@endforeach

Note: Electric bills that are not approved (status ≠ 1 or is_approve ≠ 1) will not be displayed to clients on their end.
@endsection