Beispiel #1
1
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $articles = Article::with('author')->orderBy('position', 'DESC')->orderBy('created_at', 'DESC')->limit(4)->get();
     //		TODO: abstract to model
     $sliders = Photo::join('photo_albums', 'photo_albums.id', '=', 'photos.photo_album_id')->where('photos.slider', 1)->orderBy('photos.position', 'DESC')->orderBy('photos.created_at', 'DESC')->select('photos.filename', 'photos.name', 'photos.description', 'photo_albums.folder_id')->get();
     $photoAlbums = PhotoAlbum::select(array('photo_albums.id', 'photo_albums.name', 'photo_albums.description', 'photo_albums.folder_id', DB::raw('(select filename from ' . DB::getTablePrefix() . 'photos WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'photos.photo_album_id=' . DB::getTablePrefix() . 'photo_albums.id LIMIT 1) AS album_image'), DB::raw('(select filename from ' . DB::getTablePrefix() . 'photos WHERE ' . DB::getTablePrefix() . 'photos.photo_album_id=' . DB::getTablePrefix() . 'photo_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
     $videoAlbums = VideoAlbum::select(array('video_albums.id', 'video_albums.name', 'video_albums.description', 'video_albums.folder_id', DB::raw('(select youtube from ' . DB::getTablePrefix() . 'videos WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'videos.video_album_id=' . DB::getTablePrefix() . 'video_albums.id LIMIT 1) AS album_image'), DB::raw('(select youtube from ' . DB::getTablePrefix() . 'videos WHERE ' . DB::getTablePrefix() . 'videos.video_album_id=' . DB::getTablePrefix() . 'video_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
     $categoriesArray = Object::where('type', 'category')->get();
     $categories = array();
     foreach ($categoriesArray as $category) {
         $categories[] = array($category->title);
     }
     $categories = Object::where('type', 'category')->get();
     global $types;
     $types = Object::getTypes()->select(array('id', DB::raw("REPLACE(name, '_object_type_', '') as name"), DB::raw("REPLACE(title, 'Object Type: ', '') as title"), 'created_at'))->get();
     return view('pages.home', compact('articles', 'sliders', 'videoAlbums', 'photoAlbums', 'categories', 'types'));
     //return view('pages.welcome');
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $albums = PhotoAlbum::where('user_id', $id)->where('type', 'album')->get();
     $business = Business::findOrFail($id);
     return view('photoAlbum.show')->withAlbums($albums)->withBusiness($business);
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $articles = Article::with('author')->orderBy('position', 'DESC')->orderBy('created_at', 'DESC')->limit(4)->get();
     $photoAlbums = PhotoAlbum::select(array('photo_albums.id', 'photo_albums.name', 'photo_albums.description', 'photo_albums.folder_id', DB::raw('(select filename from photos WHERE album_cover=TRUE and photos.photo_album_id=photo_albums.id LIMIT 1) AS album_image'), DB::raw('(select filename from photos WHERE photos.photo_album_id=photo_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
     $videoAlbums = VideoAlbum::select(array('video_albums.id', 'video_albums.name', 'video_albums.description', 'video_albums.folder_id', DB::raw('(select youtube from videos WHERE album_cover=TRUE and videos.video_album_id=video_albums.id LIMIT 1) AS album_image'), DB::raw('(select youtube from videos WHERE videos.video_album_id=video_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
     return view('pages.home', compact('articles', 'videoAlbums', 'photoAlbums'));
 }
Beispiel #4
0
 public function index()
 {
     $news = $this->news->orderBy('position', 'DESC')->orderBy('created_at', 'DESC')->limit(4)->get();
     $sliders = Photo::join('photo_album', 'photo_album.id', '=', 'photo.photo_album_id')->where('photo.slider', 1)->orderBy('photo.position', 'DESC')->orderBy('photo.created_at', 'DESC')->select('photo.filename', 'photo.name', 'photo.description', 'photo_album.folderid')->get();
     $photoalbums = PhotoAlbum::select(array('photo_album.id', 'photo_album.name', 'photo_album.description', 'photo_album.folderid', DB::raw('(select filename from ' . DB::getTablePrefix() . 'photo WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'photo.photo_album_id=' . DB::getTablePrefix() . 'photo_album.id) AS album_image'), DB::raw('(select filename from ' . DB::getTablePrefix() . 'photo WHERE ' . DB::getTablePrefix() . 'photo.photo_album_id=' . DB::getTablePrefix() . 'photo_album.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
     $videoalbums = VideoAlbum::select(array('video_album.id', 'video_album.name', 'video_album.description', 'video_album.folderid', DB::raw('(select youtube from ' . DB::getTablePrefix() . 'video as v WHERE album_cover=TRUE and v.video_album_id=' . DB::getTablePrefix() . 'video_album.id) AS album_image'), DB::raw('(select youtube from ' . DB::getTablePrefix() . 'video WHERE ' . DB::getTablePrefix() . 'video.video_album_id=' . DB::getTablePrefix() . 'video_album.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
     return view('site.home.index', compact('news', 'sliders', 'videoalbums', 'photoalbums'));
 }
 /**
  * Handle the event.
  *
  * @param  UserWasDeleted  $event
  * @return void
  */
 public function handle(UserWasDeleted $event)
 {
     // Delete everything the user created
     Article::where('user_id', $event->user_id)->delete();
     Photo::where('user_id', $event->user_id)->delete();
     PhotoAlbum::where('user_id', $event->user_id)->delete();
     Video::where('user_id', $event->user_id)->delete();
     VideoAlbum::where('user_id', $event->user_id)->delete();
 }
 public function index()
 {
     $title = "Dashboard";
     $article = Article::count();
     $articlecategory = ArticleCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     return view('admin.dashboard.index', compact('title', 'article', 'articlecategory', 'photo', 'photoalbum', 'users'));
 }
Beispiel #7
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $articles = Article::with('author')->orderBy('position', 'DESC')->orderBy('created_at', 'DESC')->limit(4)->get();
     //		TODO: abstract to model
     $sliders = Photo::join('photo_albums', 'photo_albums.id', '=', 'photos.photo_album_id')->where('photos.slider', 1)->orderBy('photos.position', 'DESC')->orderBy('photos.created_at', 'DESC')->select('photos.filename', 'photos.name', 'photos.description', 'photo_albums.folder_id')->get();
     $photoAlbums = PhotoAlbum::select(array('photo_albums.id', 'photo_albums.name', 'photo_albums.description', 'photo_albums.folder_id', DB::raw('(select filename from ' . DB::getTablePrefix() . 'photos WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'photos.photo_album_id=' . DB::getTablePrefix() . 'photo_albums.id LIMIT 1) AS album_image'), DB::raw('(select filename from ' . DB::getTablePrefix() . 'photos WHERE ' . DB::getTablePrefix() . 'photos.photo_album_id=' . DB::getTablePrefix() . 'photo_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
     $videoAlbums = VideoAlbum::select(array('video_albums.id', 'video_albums.name', 'video_albums.description', 'video_albums.folder_id', DB::raw('(select youtube from ' . DB::getTablePrefix() . 'videos WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'videos.video_album_id=' . DB::getTablePrefix() . 'video_albums.id LIMIT 1) AS album_image'), DB::raw('(select youtube from ' . DB::getTablePrefix() . 'videos WHERE ' . DB::getTablePrefix() . 'videos.video_album_id=' . DB::getTablePrefix() . 'video_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
     return view('pages.home', compact('articles', 'sliders', 'videoAlbums', 'photoAlbums'));
     //return view('pages.welcome');
 }
 public function index()
 {
     $title = "Dashboard";
     $news = News::count();
     $newscategory = NewsCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     $video = Video::count();
     $videoalbum = VideoAlbum::count();
     return view('admin.dashboard.index', compact('title', 'news', 'newscategory', 'video', 'videoalbum', 'photo', 'photoalbum', 'users'));
 }
 /**
  * Display a loggedin user's business albums.
  *
  * @return Response
  */
 public function photos($id)
 {
     //all users
     $user = User::where('userName', $id)->first();
     if (empty($user)) {
         return redirect()->back();
     }
     $userDetail = UserDetail::where('userId', $user->id)->first();
     $business = Business::find($userDetail->businessId);
     if (empty($business)) {
         return redirect('/user/' . $user->userName . '/profile');
     }
     $business = (object) array_merge($user->toArray(), $userDetail->toArray(), $business->toArray());
     $albums = PhotoAlbum::where('user_id', $business->userId)->where('type', 'album')->get();
     return view('business.photos')->withBusiness($business)->withAlbums($albums);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update(PhotoRequest $request, Photo $photo)
 {
     $photo->user_id_edited = Auth::id();
     $picture = $photo->filename;
     if ($request->hasFile('image')) {
         $file = $request->file('image');
         $filename = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $picture = sha1($filename . time()) . '.' . $extension;
     }
     $photo->filename = $picture;
     $photo->update($request->except('image'));
     if ($request->hasFile('image')) {
         $photoalbum = PhotoAlbum::find($request->photo_album_id);
         $destinationPath = public_path() . '/appfiles/photoalbum/' . $photoalbum->folder_id . '/';
         $request->file('image')->move($destinationPath, $picture);
     }
 }
 /**
  * Show a list of all the languages posts formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function data()
 {
     $photo_category = PhotoAlbum::join('languages', 'languages.id', '=', 'photo_albums.language_id')->select(array('photo_albums.id', 'photo_albums.name', 'languages.name as language', 'photo_albums.id as images_count', 'photo_albums.created_at'));
     return Datatables::of($photo_category)->edit_column('images_count', '<a class="btn btn-primary btn-sm" >{{ \\App\\Photo::where(\'photo_album_id\', \'=\', $id)->count() }}</a>')->add_column('actions', '<a href="{{{ URL::to(\'admin/photoalbum/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" >{{ trans("admin/modal.edit") }}</a>
                 <a href="{{{ URL::to(\'admin/photoalbum/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe">{{ trans("admin/modal.delete") }}</a>
                 <input type="hidden" name="row" value="{{$id}}" id="row">')->make();
 }
 public function show($id)
 {
     $photo_album = PhotoAlbum::find($id);
     $photos = Photo::where('photo_album_id', $id)->get();
     return view('photo.view_album', compact('photos', 'photo_album'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function postEdit(PhotoRequest $request, $id)
 {
     $photo = Photo::find($id);
     $photo->user_id = Auth::id();
     $photo->language_id = $request->language_id;
     $photo->name = $request->name;
     $photo->photo_album_id = $request->photo_album_id;
     $photo->description = $request->description;
     $photo->slider = $request->slider;
     $photo->album_cover = $request->album_cover;
     $picture = $photo->filename;
     if ($request->hasFile('image')) {
         $file = $request->file('image');
         $filename = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $picture = sha1($filename . time()) . '.' . $extension;
     }
     $photo->filename = $picture;
     $photo->save();
     if ($request->hasFile('image')) {
         $photoalbum = PhotoAlbum::find($request->photo_album_id);
         $destinationPath = public_path() . '/appfiles/photoalbum/' . $photoalbum->folder_id . '/';
         $request->file('image')->move($destinationPath, $picture);
         $path2 = public_path() . '/appfiles/photoalbum/' . $photoalbum->folder_id . '/thumbs/';
         Thumbnail::generate_image_thumbnail($destinationPath . $picture, $path2 . $picture);
     }
 }
 /**
  * Reorder items
  *
  * @param items list
  * @return items from @param
  */
 public function getReorder(ReorderRequest $request)
 {
     $list = $request->list;
     $items = explode(",", $list);
     $order = 1;
     foreach ($items as $value) {
         if ($value != '') {
             PhotoAlbum::where('id', '=', $value)->update(array('position' => $order));
             $order++;
         }
     }
     return $list;
 }
Beispiel #15
0
 /**
  * Display a loggedin user's business albums.
  *
  * @return Response
  */
 public function photos()
 {
     $user = User::find(Auth::user()->id);
     $userDetail = UserDetail::where('userId', $user->id)->first();
     $business = Business::find($userDetail->businessId);
     if (empty($business)) {
         $business = (object) array_merge($user->toArray(), $userDetail->toArray());
     } else {
         $business = (object) array_merge($user->toArray(), $userDetail->toArray(), $business->toArray());
     }
     $albums = PhotoAlbum::where('user_id', Auth::user()->id)->where('type', 'album')->get();
     return view('home.photos')->withBusiness($business)->withAlbums($albums);
 }