%PDF- %PDF-
Direktori : /home/ugotscom/3vfm3/app/Http/Controllers/ |
Current File : /home/ugotscom/3vfm3/app/Http/Controllers/PropertyController.php |
<?php namespace App\Http\Controllers; use App\Property; use App\Leads; use Illuminate\Http\Request; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Storage; class PropertyController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $data=Property::orderBy('id', 'DESC')->paginate(5); 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) { $property = new Property; $property->client_id=$request->client_id; $property->title=$request->title; $property->description=$request->description; $property->property_for=$request->property_for; $property->property_type=$request->property_type; $property->price=$request->price; $property->latitude=$request->latitude; $property->longitude=$request->longitude; $property->location=$request->location; $property->carpet_area=$request->area; $property->bhk=$request->bhk; $property->project=$request->project; $property->save(); } /** * Display the specified resource. * * @param \App\Property $property * @return \Illuminate\Http\Response */ public function show(Property $property) { // $users=Property::all(); return $users; } /** * Show the form for editing the specified resource. * * @param \App\Property $property * @return \Illuminate\Http\Response */ public function edit(Property $property) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Property $property * @return \Illuminate\Http\Response */ public function update(Request $request, Property $property) { // } /** * Remove the specified resource from storage. * * @param \App\Property $property * @return \Illuminate\Http\Response */ public function destroy(Property $property) { // } public function searchproperty(Request $request){ $property_for=$request->property_for; $users=Property::where('property_for',$property_for) ->where('property_for',$property_for) ->paginate(20); return response()->json($users); } public function formSubmit(Request $request) { $imageName = time().'.'.$request->image->getClientOriginalExtension(); $request->image->move(public_path('images'), $imageName); return response()->json(['success'=>'You have successfully upload image.']); } public function propertybyid($id){ $properties=Property::where('client_id',$id)->paginate(1); return response()->json($properties); } public function clientproperties($id){ $properties=Property::where('client_id',$id)->get(); return response()->json($properties); } public function uploadFile(Request $request) { $filename = $file->getClientOriginalName(); $path = hash( 'sha256', time()); if(Storage::disk('uploads')->put($path.'/'.$filename, File::get($file))) { $input['filename'] = $filename; $input['mime'] = $file->getClientMimeType(); $input['path'] = $path; $input['size'] = $file->getClientSize(); $file = FileEntry::create($input); return response()->json([ 'success' => true, 'id' => $file->id ], 200); } return response()->json([ 'success' => false ], 500); } }