本文整理匯總了PHP中Illuminate\Http\Response::view方法的典型用法代碼示例。如果您正苦於以下問題:PHP Response::view方法的具體用法?PHP Response::view怎麽用?PHP Response::view使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Http\Response
的用法示例。
在下文中一共展示了Response::view方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addUserGang
/**
* Ajout d'un jouer dans un gang
*/
public function addUserGang(Request $request, Guard $auth)
{
if ($request->isMethod('POST')) {
$playerId = $request->get("playerid");
$groupId = $request->get("groupId");
$gang = DB::table('gangs')->where('id', $groupId)->first();
$suppr = array("\"", "`", "[", "]");
$lineGang = str_replace($suppr, "", $gang->members);
$ArrayGang = preg_split("/,/", $lineGang);
$gangMembers = array();
if ($auth->user()->arma == $gang->owner) {
if (count($ArrayGang) <= $gang->maxmembers) {
foreach ($ArrayGang as $member) {
$gangMembers[] = $member;
}
if (env('DB_EXTDB') == 1) {
$gangMembersString = '[';
} elseif (env('DB_EXTDB') == 2) {
$gangMembersString = '"[';
}
$gangList = "";
foreach ($gangMembers as $gangMember) {
$gangList .= "`" . $gangMember . "`,";
}
$gangList .= "`" . $playerId . "`,";
$gangList = rtrim($gangList, ",");
$gangMembersString .= $gangList;
if (env('DB_EXTDB') == 1) {
$gangMembersString .= ']';
} elseif (env('DB_EXTDB') == 2) {
$gangMembersString .= ']"';
}
DB::table('gangs')->where('id', $groupId)->update(array('members' => $gangMembersString));
return redirect(url('player'))->with('success', 'Le joueur à bien rajouté au gang');
} else {
return redirect(url('player'))->with('error', 'Vous avez atteint le nombre maximum de membres');
}
} else {
return Response::view('errors.403', array(), 403);
}
}
}