@php use App\Models\{Property,PropertyOwner,Customer,PropertyPlot,User,Order}; $propertyids = Property::where('propertyownerid', Auth::user()->propertyownerid)->pluck('id'); $customerids = Order::whereIn('propertyid', $propertyids)->pluck('userid')->toArray(); $customers = User::whereIn('uid', $customerids)->get(); $orders=Order::whereIn('propertyid', $propertyids)->get(); @endphp
Projects
Total Projects

{{Property::where('propertyownerid',Auth::user()->propertyownerid)->count()}}

Plots
Total Plots
@php $project_ids=Property::where('propertyownerid',Auth::user()->propertyownerid)->pluck('id'); $propertyplots=PropertyPlot::whereIn('propertyid',$project_ids)->count();; @endphp

{{$propertyplots}}

Customers
Total Customers

{{count($customers)}}

Amount Ordered
This Year

TZS {{number_format(Order::whereIn('propertyid', $propertyids)->whereYear('created_at',date('Y'))->sum('amount'),0,'.',',')}}

This Month

TZS {{number_format(Order::whereIn('propertyid', $propertyids)->whereYear('created_at',date('Y'))->whereMonth('created_at',date('M'))->sum('amount'),0,'.',',')}}

Completed Orders
This Year

{{Order::whereIn('propertyid',$propertyids)->whereYear('created_at',date('Y'))->where('status',2)->count()}}

This Month

{{Order::whereIn('propertyid',$propertyids)->whereYear('created_at',date('Y'))->whereMonth('created_at',date('M'))->where('status',2)->count()}}

Completed Order Amount
This Year

TZS {{number_format(Order::whereIn('propertyid', $propertyids)->whereYear('created_at',date('Y'))->where('status',2)->sum('amount'),0,'.',',')}}

This Month

TZS {{number_format(Order::whereIn('propertyid', $propertyids)->whereYear('created_at',date('Y'))->whereMonth('created_at',date('M'))->where('status',2)->sum('amount'),0,'.',',')}}

Projects

{{Property::where('propertyownerid',Auth::user()->propertyownerid)->count()}} Results Found

@foreach(Property::where('propertyownerid',Auth::user()->propertyownerid)->get() as $index => $p) @endforeach
# Name Status Description Created On Action
{{++$index}} {{$p->name}} {{$p->status_description}} {{$p->created_at}} View More