本文整理汇总了PHP中app\models\Payment::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::select方法的具体用法?PHP Payment::select怎么用?PHP Payment::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Payment
的用法示例。
在下文中一共展示了Payment::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResult
public function getResult(Request $request)
{
$out_sum = $request->get('OutSum');
$inv_id = $request->get('InvId');
$user = Payment::select('user_id')->where('uid', '=', $inv_id)->first();
$checksum = $request->get('SignatureValue');
$password2 = config('roboconfig.password2');
if (strtolower($checksum) == strtolower(md5($out_sum . ":" . $inv_id . ":" . $password2))) {
if (Payment::where('uid', '=', $inv_id) && Payment::where('balance', '=', $out_sum)) {
try {
DB::beginTransaction();
$payment = Payment::where('uid', '=', $inv_id)->first();
if ($payment->status == 0) {
$payment->status = 1;
$payment->update();
$addBalanceToUser = User::find($user->user_id);
$addBalanceToUser->balance += $out_sum;
$addBalanceToUser->update();
}
DB::commit();
} catch (\PDOException $e) {
\Session::flash('message', "{$e->getMessage}()");
DB::connection()->getPdo()->rollBack();
}
}
}
return redirect()->action('ProfileController@index');
}
示例2: adminGraph
public function adminGraph()
{
$result = ['newcomers' => [], 'orga' => ['wei' => 0, 'sandwitch' => 0, 'guarantee' => 0], 'ce' => ['wei' => 0, 'sandwitch' => 0, 'guarantee' => 0], 'vieux' => ['wei' => 0, 'sandwitch' => 0, 'guarantee' => 0]];
$newscomers = Newcomer::with('weiPayment', 'sandwichPayment', 'guaranteePayment')->get();
$students = Student::with('weiPayment', 'sandwichPayment', 'guaranteePayment')->get();
foreach ($newscomers as $newcomer) {
if (!isset($result['newcomers'][$newcomer->branch])) {
$result['newcomers'][$newcomer->branch] = [];
$result['newcomers'][$newcomer->branch]['wei'] = 0;
$result['newcomers'][$newcomer->branch]['sandwitch'] = 0;
$result['newcomers'][$newcomer->branch]['guarantee'] = 0;
}
if (isset($newcomer->weiPayment) && $newcomer->weiPayment->state == 'paid') {
$result['newcomers'][$newcomer->branch]['wei'] += 1;
}
if (isset($newcomer->sandwichPayment) && $newcomer->sandwichPayment->state == 'paid') {
$result['newcomers'][$newcomer->branch]['sandwitch'] += 1;
}
if (isset($newcomer->guaranteePayment) && $newcomer->guaranteePayment->state == 'paid') {
$result['newcomers'][$newcomer->branch]['guarantee'] += 1;
}
}
foreach ($students as $student) {
$ret =& $result['vieux'];
if ($student->ce && $student->team_accepted && $student->team_id) {
$ret =& $result['ce'];
} elseif ($student->orga) {
$ret =& $result['orga'];
}
if (isset($student->weiPayment) && $student->weiPayment->state == 'paid') {
$ret['wei'] += 1;
}
if (isset($student->sandwichPayment) && $student->sandwichPayment->state == 'paid') {
$ret['sandwitch'] += 1;
}
if (isset($student->guaranteePayment) && $student->guaranteePayment->state == 'paid') {
$ret['guarantee'] += 1;
}
}
$graphPaid = Payment::select(DB::raw('DATE_FORMAT(created_at,\'%d-%m-%Y\') as day'), DB::raw('COUNT(id) as sum'))->where('type', 'payment')->where('state', 'paid')->where('amount', '>', 325)->orderBy('created_at')->groupBy(DB::raw('DATE_FORMAT(created_at,\'%d-%m-%Y\')'))->get();
$graphCaution = Payment::select(DB::raw('DATE_FORMAT(created_at,\'%d-%m-%Y\') as day'), DB::raw('COUNT(id) as sum'))->where('type', 'guarantee')->where('state', 'paid')->orderBy('created_at')->groupBy(DB::raw('DATE_FORMAT(created_at,\'%d-%m-%Y\')'))->get();
$graphFood = Payment::select(DB::raw('DATE_FORMAT(created_at,\'%d-%m-%Y\') as day'), DB::raw('COUNT(id) as sum'))->where('type', 'payment')->where(DB::raw('`amount`%500'), 325)->where('state', 'paid')->orderBy('created_at')->groupBy(DB::raw('DATE_FORMAT(created_at,\'%d-%m-%Y\')'))->get();
$sum = ['paid' => array_sum(array_column($graphPaid->toArray(), 'sum')), 'caution' => array_sum(array_column($graphCaution->toArray(), 'sum')), 'food' => array_sum(array_column($graphFood->toArray(), 'sum'))];
return View::make('dashboard.wei.graph', ['graphPaid' => $graphPaid, 'graphCaution' => $graphCaution, 'graphFood' => $graphFood, 'sum' => $sum, 'global' => $result]);
}
示例3: getResult
/**
* @param Request $request
* @return \Illuminate\Http\RedirectResponse|void
*/
public function getResult(Request $request)
{
if ($_SERVER['REMOTE_ADDR'] != '37.59.221.230') {
return;
}
//dd(\Request::all());
$m_key = 'halyava';
$m_shop = $request->get('m_shop');
$m_orderid = $request->get('m_orderid');
$m_amount = $request->get('m_amount');
$m_curr = $request->get('m_curr');
$m_desc = $request->get('m_desc');
$checksum = $request->get('m_sign');
$user = Payment::select('user_id')->where('uid', '=', $m_orderid)->first();
if (isset($_POST['m_operation_id']) && isset($checksum)) {
$arHash = array($m_shop, $m_orderid, $m_amount, $m_curr, $m_desc, $m_key);
$sign_hash = strtoupper(hash('sha256', implode(':', $arHash)));
if ($checksum == $sign_hash && $_POST['m_status'] == 'success') {
if (Payment::where('uid', '=', $m_orderid) && Payment::where('balance', '=', $m_amount)) {
try {
DB::beginTransaction();
$payment = Payment::where('uid', '=', $m_orderid)->first();
if ($payment->status == 0) {
$payment->status = 1;
$payment->update();
$addBalanceToUser = User::find($user->user_id);
$addBalanceToUser->balance += $m_amount;
$addBalanceToUser->update();
}
DB::commit();
} catch (\PDOException $e) {
\Session::flash('message', "{$e->getMessage}()");
DB::connection()->getPdo()->rollBack();
}
}
}
}
return redirect()->action('ProfileController@index');
}