本文整理汇总了PHP中App\Http\Controllers\Session::pull方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::pull方法的具体用法?PHP Session::pull怎么用?PHP Session::pull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Controllers\Session
的用法示例。
在下文中一共展示了Session::pull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$content = Maintext::find(1);
$express = session('express');
$loginfo = \Session::pull('loginfo');
if (!$loginfo) {
$loginfo = null;
}
return view($this->localeDir . 'templates.content', compact('content', 'loginfo', 'express'));
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$startTime = microtime(true);
$sId = \Session::get('currentSerie');
$series = loadSerieWithIdOrTitleAndExercise($sId, $id);
if (empty($series)) {
$series = loadSeriesWithExercise($id);
if (count($series) == 1) {
$sId = $series[0]->id;
} elseif (count($series) > 1) {
return view('series.duplicates', compact('series'));
} else {
flash()->error("Something went horribly wrong. Try reproducing the problem & notify the devs please...")->important();
return redirect('/');
}
} elseif (count($series) == 1) {
$sId = $series[0]->id;
} elseif (count($series) > 1) {
return view('series.duplicates', compact('series'));
} else {
flash()->error("Something went horribly wrong. Try reproducing the problem & notify the devs please...")->important();
return redirect('/');
}
\Session::put('currentSerie', $sId);
$exercise = loadExercise($id)[0];
if ($exercise->expected_result != "*") {
$exercise->expected_result = null;
}
$result = null;
$answer = null;
if (\Session::has('result')) {
$result = \Session::pull('result', '');
}
if (\Session::has('answer')) {
$answer = \Session::pull('answer', '');
}
return view('exercises.show', compact('exercise', 'result', 'answer', 'sId', 'startTime'));
}