Beispiel #1
0
 public function getTranslationFeed($type = null)
 {
     $languageCode = Request::query('language') ?: null;
     if ($type == 'loans') {
         $loans = LoanQuery::create()->condition('summery', 'Loan.SummaryTranslation IS NULL')->condition('proposal', 'Loan.ProposalTranslation IS NULL')->where(array('summery', 'proposal'), 'or')->_or()->useBorrowerQuery()->useProfileQuery()->condition('aboutMe', 'Profile.AboutMeTranslation IS NULL')->condition('aboutBusiness', 'Profile.AboutBusinessTranslation IS NULL')->where(array('aboutMe', 'aboutBusiness'), 'or')->endUse()->endUse();
         if ($languageCode) {
             $loans->filterByLanguageCode($languageCode);
         }
         $page = Request::query('page') ?: 1;
         $paginator = $loans->paginate($page, 10);
     } else {
         $type = 'comments';
         $comments = CommentQuery::create()->where('Comment.BorrowerId = Comment.UserId')->filterByMessageTranslation(null);
         if ($languageCode) {
             $comments->useBorrowerQuery()->useCountryQuery()->useLanguageQuery()->filterByLanguageCode($languageCode)->endUse()->endUse()->endUse();
         }
         $page = Request::query('page') ?: 1;
         $paginator = $comments->paginate($page, 10);
     }
     return View::make('admin.translation-feed', compact('type', 'loans', 'comments', 'paginator'), ['form' => $this->translationFeedForm]);
 }
Beispiel #2
0
 public function postDeleteUpload()
 {
     $comment = CommentQuery::create()->filterById(\Input::get('comment_id'))->findOne();
     $upload = \Zidisha\Upload\UploadQuery::create()->filterById(\Input::get('upload_id'))->findOne();
     $user = \Auth::user();
     if (!$comment || !$upload || $comment->getUserId() != $user->getId()) {
         App::abort(404, 'Bad Request');
     }
     $this->commentService->deleteUpload($comment, $upload);
     Flash::success(\Lang::get('comments.flash.file-deleted'));
     return Redirect::back();
 }