public function getFinalist($photosId)
 {
     if (!ACL::hasPermission('photos', 'edit')) {
         return redirect(route('photos'))->withErrors(['Você não tem permissão para editar o status das fotos.']);
     }
     $folder = $this->folder;
     $photo = Photos::where('photos.photosId', '=', $photosId)->join('users', 'users.id', '=', 'photos.usersId')->orderBy('photos.created_at', 'DESC')->addSelect('photos.photosId')->addSelect('photos.created_at')->addSelect('photos.photo')->addSelect('photos.urlInstagram')->addSelect('photos.status')->addSelect('users.id AS userId')->addSelect('users.babyName')->addSelect('users.name')->first();
     return view('admin.photos.finalist')->with(compact('photo', 'folder'));
 }
예제 #2
0
 public function GetSlugAttribute()
 {
     if (env('IMAGE_GET') == 'local') {
         $files = \File::allFiles(storage_path('app/accountancy/' . $this->id));
         return implode('|', $files);
     } else {
         $files = Photos::where('slug', 'like', 'accountancy%')->where('photo_id', $this->id)->get();
         return $files;
     }
 }
 public function postCategory(Request $request)
 {
     if ($request->table == 'videos') {
         $consult = Videos::where('status', '=', 2)->where('winner', '=', 0)->join('users', 'videos.usersId', '=', 'id')->get();
     } else {
         if ($request->table == 'photos') {
             $consult = Photos::where('status', '=', 2)->where('winner', '=', 0)->join('users', 'photos.usersId', '=', 'id')->get();
         }
     }
     return json_encode($consult);
 }
 public function getView($usersId)
 {
     if (!ACL::hasPermission('participants')) {
         return redirect(route('participants'))->withErrors(['Você não tem permissão para visualizar dados dos participantes.']);
     }
     $user = User::where('id', '=', $usersId)->first();
     $photos = Photos::where('usersId', '=', $usersId)->get();
     $videos = Videos::where('usersId', '=', $usersId)->get();
     foreach ($videos as $video) {
         array_add($video, "image", Advertising::imageVideo($video->url));
         array_set($video, "url", Advertising::embedVideo($video->url, 1));
     }
     $usersReceipts = UsersReceipts::where('usersId', '=', $usersId)->get();
     return view('admin.participants.view')->with(compact('user', 'photos', 'videos', 'usersReceipts'));
 }
 public function index()
 {
     $page = 'finalistas';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     if ($websiteSettings['votingOk'] == 0) {
         $message = "A página que você tentou acessar está indisponível no momento ou não existe";
         return redirect('/')->with(compact('message'));
     }
     $pages = Pages::where('slug', '=', $page)->first();
     $advertising = Advertising::orderByRaw("RAND()")->get();
     foreach ($advertising as $ad) {
         array_add($ad, "image", Advertising::imageVideo($ad->url));
         array_set($ad, "url", Advertising::embedVideo($ad->url, 1));
     }
     $calls = Calls::orderByRaw("RAND()")->limit(2)->get();
     $finalistsPhotos = Photos::where('photos.status', '=', 2)->where('urlInstagram', '!=', '')->join('users', 'users.id', '=', 'photos.usersId')->addSelect('users.babyName')->addSelect('users.city')->addSelect('users.state')->addSelect('photos.usersId')->addSelect('photos.photo')->addSelect('photos.urlInstagram')->orderByRaw('RAND()')->get();
     $finalistsVideos = Videos::where('videos.status', '=', 2)->where('urlInstagram', '!=', '')->join('users', 'users.id', '=', 'videos.usersId')->addSelect('users.babyName')->addSelect('users.city')->addSelect('users.state')->addSelect('videos.url')->addSelect('videos.urlInstagram')->orderByRaw('RAND()')->get();
     foreach ($finalistsVideos as $wiVi) {
         array_add($wiVi, "image", Advertising::imageVideo($wiVi->url));
     }
     return view('website.finalists')->with(compact('page', 'websiteSettings', 'pages', 'advertising', 'calls', 'finalistsPhotos', 'finalistsVideos'));
 }
 public function postSentPhotos(Request $request)
 {
     $photos = Photos::where('usersId', '=', $request->userId)->addSelect('usersId')->addSelect('photo')->get();
     return json_encode($photos);
 }
예제 #7
0
 public function ScopeSimilar($query, $photo_type, $photo_id)
 {
     $match = ['photo_type' => $photo_type, 'photo_id' => $photo_id];
     return Photos::where($match)->get();
 }
예제 #8
0
 public function photos($usersId)
 {
     return Photos::where('usersId', '=', $usersId);
 }