%PDF- %PDF-
Direktori : /home/ugotscom/kma/app/Http/Controllers/ |
Current File : /home/ugotscom/kma/app/Http/Controllers/WantedLocationController.php |
<?php namespace App\Http\Controllers; use App\WantedLocation; use Illuminate\Http\Request; class WantedLocationController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $data=WantedLocation::select('*')->get(); return response()->json($data); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { // } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { // } /** * Display the specified resource. * * @param \App\WantedLocation $wantedLocation * @return \Illuminate\Http\Response */ public function show(WantedLocation $wantedLocation) { // } /** * Show the form for editing the specified resource. * * @param \App\WantedLocation $wantedLocation * @return \Illuminate\Http\Response */ public function edit(WantedLocation $wantedLocation) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\WantedLocation $wantedLocation * @return \Illuminate\Http\Response */ public function update(Request $request, WantedLocation $wantedLocation) { // } /** * Remove the specified resource from storage. * * @param \App\WantedLocation $wantedLocation * @return \Illuminate\Http\Response */ public function destroy(WantedLocation $wantedLocation) { // } public function wantedlocationwise($id){ $properties = WantedLocation::where('property_for',$id)->leftJoin('locations','locations.location_id','=','wanted_locations.location')->groupBy('wanted_locations.location') ->selectRaw('count(*) as total, locations.location') ->orderBy('total','DESC') ->limit(10) ->get(); return response()->json($properties); } public function propertytypewise($id){ $properties['rent'] = WantedLocation::where('location',$id)->where('wanted_locations.property_for',1)->leftJoin('property_type','property_type.property_type_id','=','wanted_locations.property_type')->groupBy('wanted_locations.property_type') ->selectRaw('count(*) as total, property_type.property_for_type') ->orderBy('total','DESC') ->limit(10) ->get(); return response()->json($properties); } public function propertytypewisesale($id){ $properties['rent'] = WantedLocation::where('location',$id)->where('wanted_locations.property_for',2)->leftJoin('property_type','property_type.property_type_id','=','wanted_locations.property_type')->groupBy('wanted_locations.property_type') ->selectRaw('count(*) as total, property_type.property_for_type') ->orderBy('total','DESC') ->limit(10) ->get(); return response()->json($properties); } }