/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function uploadUserImage(Request $request) { $this->validate($request, ['imageTitle' => 'required|max:20|min:3', 'locationImage' => 'required|image', 'imageDescription' => 'required|max:100|min:10']); $uploadImage = new PhotoMapImageUploader(); $uploadImage->title = $request->get('imageTitle'); $uploadImage->userId = \Auth::user()->id; $fileName = uniqid() . '.' . $request->file('locationImage')->getClientOriginalExtension(); \Image::make($request->file('locationImage'))->save('img/PhotoMap/' . $fileName); $uploadImage->locationImage = $fileName; $uploadImage->markerLocationId = $request->imageLocation; $uploadImage->imageDescription = $request->get('imageDescription'); $uploadImage->save(); return redirect('photoMap'); }
public function getMarkers() { $MarkerLocation = Marker_location::orderBy('id')->get(); $allUserPhotos = PhotoMapImageUploader::orderBy('photoMapId')->get(); $dataToSend = ['markers' => $MarkerLocation, 'images' => $allUserPhotos]; return Response::json($dataToSend); }
public function deleteUserImage($deleteImageId) { $deleteUserImage = PhotoMapImageUploader::find($deleteImageId); //delete the image associative with the event \File::Delete('img/PhotoMap/' . $deleteUserImage->locationImage); $deleteUserImage->delete(); return redirect('admin'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $allUserPosts = Posts::where('user_id', \Auth::user()->id)->orderBy('created_at', 'DESC')->get(); // $UAI = UserAdditionalInfo::findOrFail($UAI_id); // $userInfo = UserAdditionalInfo::where('user_id', \Auth::user()->id)->first(); $userInfo = \Auth::user(); $allEvents = Events::orderBy('created_at', 'DESC')->take(2)->get(); $allUserPhotos = PhotoMapImageUploader::where('userId', \Auth::user()->id)->orderBy('photoMapId', 'DESC')->take(6)->get(); return view('profilePage.index', compact('allUserPosts', 'userInfo', 'allEvents', 'allUserPhotos')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $allPost = Posts::orderBy('created_at', 'DESC')->get(); //getting all the post from post database table $userInfo = \Auth::user(); $allEvents = Events::orderBy('created_at', 'DESC')->take(2)->get(); $allUserPhotos = PhotoMapImageUploader::orderBy('photoMapId', 'DESC')->take(6)->get(); // $postId = $allPost->id; // $TotalComments = Comments::where('on_post', '5')->count(); // dd($TotalComments); return view('home.index', compact('allPost', 'userInfo', 'allEvents', 'allUserPhotos')); }