本文整理汇总了PHP中app\Config::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::select方法的具体用法?PHP Config::select怎么用?PHP Config::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Config
的用法示例。
在下文中一共展示了Config::select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store(Request $request)
{
$userPlayers = new UserPlayers();
//$team->where('team_name', $request->team_name)->first()->contract_id;
$playerContractId = Contracts::where('player_id', $request->player_id)->select('contract_id')->first()->contract_id;
$playerClubId = Contracts::where('player_id', $request->player_id)->select('club_id')->first()->club_id;
$countPlayers = $userPlayers->join('fantasy_contracts', 'fantasy_user_players.id', '=', 'fantasy_contracts.player_id')->join('fantasy_club', 'fantasy_contracts.club_id', '=', 'fantasy_club.club_id')->where('user_id', $request->user()->id)->where('fantasy_club.club_id', $playerClubId)->count();
$config = Config::select()->first();
if ($userPlayers->where('user_id', $request->user()->id)->where('id', $playerContractId)->first()) {
$error = "havePlayer";
} elseif (!($countPlayers < $config->same_team_player)) {
$error = "playerLimit";
} elseif ($request->user()->credits - Players::where('player_id', $request->player_id)->select('price')->first()->price <= 0) {
$error = "noCredits";
} else {
User::where('id', $request->user()->id)->update(['credits' => $request->user()->credits - Players::where('player_id', $request->player_id)->select('price')->first()->price]);
$userPlayers->team_id = $request->user()->team->team_id;
$userPlayers->user_id = $request->user()->id;
$userPlayers->id = $playerContractId;
$userPlayers->save();
return redirect()->back();
}
//return new RedirectResponse(url('add_player_in_team'));
return redirect()->back()->with('error', trans('front/site.' . $error));
}