コード例 #1
0
 public function evaluateWeight($id, $loan_id)
 {
     $finance = FinancialProfile::where('user_id', '=', $id)->first();
     $count = LoanApp::where('user_id', '=', $id)->count();
     $loan_app = LoanApp::where('loan_id', '=', $loan_id)->first();
     $current_bids = Bid::where('loan_id', '=', $loan_id)->count();
     $amout = $loan_app->amount;
     $term = $loan_app->term;
     $rate = $loan_app->pref_rate;
     $residence = $finance->residence_status;
     $year_income = $finance->monthly_income * 12;
     $home_loan = $finance->home_loan;
     $car_loan = $finance->car_loan;
     $other_loan = $finance->other_loan;
     $expense = $finance->loan_repayment;
     $other_exp = $finance->other_expense;
     $house_owner = 0;
     if (strcmp($residence, 'Mortage') == 0 || strcmp($residence, 'noMortage') == 0) {
         $house_owner = 1;
     }
     $property = $finance->property;
     $vehicle = $finance->vehicle;
     $share = $finance->share;
     $other_property = $finance->others;
     $active_loan = $total_liab = $home_loan + $car_loan + $other_loan;
     $income_debt_ratio = $year_income / (1 + $count + $total_liab);
     $total_assests = $property + $vehicle + $share + $other_property;
     $disposable_income = $year_income - $total_liab;
     $sum = $rate + $house_owner + $total_assests + $income_debt_ratio + $current_bids + $disposable_income;
     $weight = pow($sum, 1 / 6);
     //$loan_app-> weight = $weight;
     return $weight;
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: jonasvr/auction
 public function buy($price)
 {
     $art->sold = 1;
     $art->sold_for = $art->price;
     $art->sold_to = Auth::user()->id;
     $art->save();
     Bid::where('art_id', $art_id)->delete();
     watchlist::where('art_id', $art_id)->delete();
 }
コード例 #3
0
 public function updateProgress($loan_id, $bid_id)
 {
     $current_sum = Bid::where('loan_id', '=', $loan_id)->sum('bid_amount');
     $loan = loanApp::where('loan_id', '=', $loan_id)->get();
     $loan_amount = $loan->amount;
     $progress = $current_sum / $loan_amount;
     $loan->progress = $progress;
     $loan->save();
     return $progress;
 }
 public function deleteBid($bidId)
 {
     Bid::where('bid_id', '=', $bidId)->delete();
     return Redirect::to('mytransaction');
 }
コード例 #5
0
ファイル: project.php プロジェクト: ajb/rfpez
 public function current_bid_draft_from($vendor)
 {
     $bid = Bid::where('project_id', '=', $this->id)->where('vendor_id', '=', $vendor->id)->where_null('submitted_at')->first();
     return $bid ? $bid : false;
 }