Ejemplo n.º 1
0
 public function bidPayment()
 {
     $form = $this->bidPaymentForm;
     $form->handleRequest(Request::instance());
     if ($form->isValid()) {
         $data = $form->getData();
     } else {
         \Zidisha\Flash\Flash::error('Form Not valid');
         return Redirect::back();
     }
 }
Ejemplo n.º 2
0
 /**
  * Handle a POST request to reset a user's password.
  *
  * @return Response
  */
 public function postReset()
 {
     $credentials = Input::only('username', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $user->setPassword($password)->save();
     });
     switch ($response) {
         case Password::INVALID_PASSWORD:
         case Password::INVALID_TOKEN:
         case Password::INVALID_USER:
             Flash::error(Lang::get($response));
             return Redirect::back();
         case Password::PASSWORD_RESET:
             return Redirect::to('/');
     }
 }
Ejemplo n.º 3
0
 public function postEditBid()
 {
     $data = \Input::all();
     $lender = \Auth::user()->getLender();
     $loan = LoanQuery::create()->filterById($data['loanId'])->findOne();
     $totalLoanAmount = $loan->getAmount();
     $amount = Money::valueOf($data['amount'], Currency::valueOf('USD'));
     $oldBid = BidQuery::create()->filterByLender($lender)->filterByLoan($loan)->findOne();
     if ($oldBid->getBidAmount()->compare($amount) != -1) {
         \Flash::error(\Lang::get('Loan.edit-bid.amount'));
         return Redirect::back()->withInput();
     }
     if ($totalLoanAmount->getAmount() <= $data['amount']) {
         \Flash::error(\Lang::get('Loan.edit-bid.interest-rate'));
         return Redirect::back()->withInput();
     }
     if ($data['interestRate'] <= $oldBid->getInterestRate()) {
         \Flash::error(\Lang::get('Loan.edit-bid.bid-amount-exceded'));
         return Redirect::back()->withInput();
     }
     $bid = BidQuery::create()->filterByLoan($loan)->filterByLender($lender)->findOne();
     $this->loanService->editBid($bid, $data);
     Flash::success(\Lang::get('Loan.edit-bid.success') . $data['amount']);
     return Redirect::route('loan:index', $data['loanId']);
 }
Ejemplo n.º 4
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();
 }