本文整理汇总了PHP中Session::pull方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::pull方法的具体用法?PHP Session::pull怎么用?PHP Session::pull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::pull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postLogin
/**
* @param LoginRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function postLogin(LoginRequest $request)
{
\Session::pull('user_organization');
// If the class is using the ThrottlesLogins trait, we can automatically throttle
// the login attempts for this application. We'll key this by the username and
// the IP address of the client making these requests into this application.
$throttles = $this->isUsingThrottlesLoginsTrait();
if ($throttles && $this->hasTooManyLoginAttempts($request)) {
return $this->sendLockoutResponse($request);
}
//Don't know why the exception handler is not catching this
try {
$this->auth->login($request);
if ($throttles) {
$this->clearLoginAttempts($request);
}
return redirect()->intended('/dashboard');
} catch (GeneralException $e) {
// If the login attempt was unsuccessful we will increment the number of attempts
// to login and redirect the user back to the login form. Of course, when this
// user surpasses their maximum number of attempts they will get locked out.
if ($throttles) {
$this->incrementLoginAttempts($request);
}
return redirect()->back()->withInput()->withFlashDanger($e->getMessage());
}
}
示例2: index
/**
* Display a listing of Tests. Factors in filter parameters
* The search string may match: patient_number, patient name, test type name, specimen ID or visit ID
*
* @return Response
*/
public function index()
{
$fromRedirect = Session::pull('fromRedirect');
if ($fromRedirect) {
$input = Session::get('TESTS_FILTER_INPUT');
} else {
$input = Input::except('_token');
}
$searchString = isset($input['search']) ? $input['search'] : '';
$testStatusId = isset($input['test_status']) ? $input['test_status'] : '';
$dateFrom = isset($input['date_from']) ? $input['date_from'] : '';
$dateTo = isset($input['date_to']) ? $input['date_to'] : '';
// Search Conditions
if ($searchString || $testStatusId || $dateFrom || $dateTo) {
$tests = Test::search($searchString, $testStatusId, $dateFrom, $dateTo);
if (count($tests) == 0) {
Session::flash('message', trans('messages.empty-search'));
}
} else {
// List all the active tests
$tests = Test::orderBy('time_created', 'DESC');
}
// Create Test Statuses array. Include a first entry for ALL
$statuses = array('all') + TestStatus::all()->lists('name', 'id');
foreach ($statuses as $key => $value) {
$statuses[$key] = trans("messages.{$value}");
}
// Pagination
$tests = $tests->paginate(Config::get('kblis.page-items'))->appends($input);
// Load the view and pass it the tests
return View::make('test.index')->with('testSet', $tests)->with('testStatus', $statuses)->withInput($input);
}
示例3: createContract
public function createContract($loan_id)
{
// Find the profile of the person who's id matches the id of the person currently logged in. Find it in DB.
$profile = UserProfile::where('id', '=', Auth::user()->id)->first();
try {
$loan = LoanApp::findOrFail($loan_id);
} catch (Exception $e) {
return Redirect::route('mytransaction')->with('message', "Could not load loan: " . $e->getMessage());
}
$lenders = $this->getLenders($loan_id);
if (empty($lenders)) {
return Redirect::route('mytransaction')->with('message', 'Could not find lenders for this loan request');
}
$contract = Contract::firstOrCreate(array('offer_id' => Input::get('offer_id', $loan_id)));
if ($contract->getAttribute('status') === 'complete') {
return Redirect::to('previewContract/' . $loan_id);
}
// todo: set these using the form
$contract->setAttribute('start_date', date('d/m/Y'));
$contract->setAttribute('end_date', date('d/m/Y'));
if (Request::isMethod('post')) {
// Check if actually posting data.
$save = $contract->fill(Input::all())->save();
$errors = Session::pull('messages', array());
if ($save === false && empty($errors)) {
$errors[] = 'Failed to save contract';
}
if (empty($errors)) {
return Redirect::to('previewContract/' . $loan_id);
}
}
$prepayment_rules = array("There are no penalties for paying off the loan early.", "Borrower must pay 5% of the original loan amount.", "Borrower must pay the complete interest of the loan.", "Borrower must pay \$100");
return View::make('createContract', compact('loan', 'lenders', 'profile', 'errors', 'contract', 'prepayment_rules'));
}
示例4: getVerificar
public function getVerificar($id = NULL)
{
if ($id == NULL) {
return Redirect::action('ErrorController@getWrongUrl');
}
return View::make('verificar', array('action' => array('Empresa_EmpresaController@postVerificar', $id), 'message_ok' => Session::pull('message_ok')));
}
示例5: getMessages
public function getMessages($message_key)
{
if (Session::has($message_key)) {
return Session::pull($message_key);
}
return array();
}
示例6: bodyScript
public static function bodyScript()
{
if (\Config::get('mixpanel.token')) {
echo '<script type="text/javascript">';
echo \Session::pull('mixpanel_body_script');
echo '</script>';
}
}
示例7: registerSocialUser
private function registerSocialUser($input)
{
$username = (string) $input['username'];
$email = (string) $input['email'];
$password = (string) $input['password'];
// Fetch user social data and destroy it at the same time
$socialData = Session::pull('socialData', 'default');
// Save new user to DB
$this->createNewUser($username, $email, $password, $socialData['provider'], $socialData['id'], $socialData['gender']);
// Sign user if they signed up with a social network
Auth::attempt(array('username' => $username, 'password' => $password));
// Create welcome message
Session::flash('welcomeMessage', 'Welcome message/Tour message: Something here...');
return true;
}
示例8: edit
/**
* 編集画面アクセスしたときのアクション
*
*/
public function edit($id)
{
$data;
if ($id == 0) {
$data = ['id' => '', 'no' => '', 'hall' => '', 'legal' => '', 'machine' => '', 'app' => 1, 'new' => '', 'unit' => '', 'deli_oneday' => date('Y-m-d'), 'open_oneday' => date('Y-m-d'), 'collect_oneday' => date('Y-m-d'), 'bill_money' => '', 'user' => '', 'method' => 1, 'collect' => '', 'collect_day' => '', 'note' => ''];
} else {
$data = TblOlddirect::whereId($id)->first();
$data['note'] = $this->selectEscape($data['note']);
$data['deli_oneday'] = $data['deli_oneday'] == "0000-00-00" ? '' : $data['deli_oneday'];
$data['open_oneday'] = $data['open_oneday'] == "0000-00-00" ? '' : $data['open_oneday'];
$data['collect_oneday'] = $data['collect_oneday'] == "0000-00-00" ? '' : $data['collect_oneday'];
$data['collect_day'] = $data['collect_day'] == "0000-00-00" ? '' : $data['collect_day'];
}
Log::debug(print_r($data, true));
return View::make('main.edit.olddirect', compact('data'))->with('message', Session::pull('message', false));
}
示例9: bs_footer
function bs_footer($page_identification = "")
{
$scripts = [assets('js/app.min.js'), assets('lang/' . session('locale', config('app.locale')) . '/locale.js'), assets('js/general.js')];
if ($page_identification !== "") {
$scripts[] = assets("js/{$page_identification}.js");
}
foreach ($scripts as $script) {
echo "<script type=\"text/javascript\" src=\"{$script}\"></script>";
}
if (Session::has('msg')) {
echo "<script>toastr.info('" . Session::pull('msg') . "');</script>";
}
echo '<script>' . Option::get("custom_js") . '</script>';
$extra_contents = [];
Event::fire(new App\Events\RenderingFooter($extra_contents));
echo implode(PHP_EOL, $extra_contents);
}
示例10: edit
/**
* 編集画面アクセスしたときのアクション
*
*/
public function edit($id)
{
$data;
if ($id == 0) {
$data = ['id' => '', 'c_s' => '1', 'class' => '1', 'no' => '---', 'day' => date('Y-m-d'), 'storage_day' => date('Y-m-d'), 'user' => '', 'bill_no' => '', 'serial_slot' => '', 'serial_case' => '', 'serial_basea' => '', 'machine' => '', 'note' => '', 'buy_legal' => '', 'buy_hall' => '', 'buy_money' => '', 'deli_money' => '', 'pay_day' => date('Y-m-d'), 'settle' => '', 'sell_legal' => '', 'sell_money' => '', 'deli_oneday' => date('Y-m-d'), 'deli_day' => '', 'delivery' => '0'];
} else {
$data = TblOldmanager::whereId($id)->first();
$data['note'] = $this->selectEscape($data['note']);
$data['day'] = $data['day'] == "0000-00-00" ? '' : $data['day'];
$data['storage_day'] = $data['storage_day'] == "0000-00-00" ? '' : $data['storage_day'];
$data['pay_day'] = $data['pay_day'] == "0000-00-00" ? '' : $data['pay_day'];
$data['deli_oneday'] = $data['deli_oneday'] == "0000-00-00" ? '' : $data['deli_oneday'];
$data['deli_day'] = $data['deli_day'] == "0000-00-00" ? '' : $data['deli_day'];
}
Log::debug(print_r($data, true));
return View::make('main.edit.oldmanager', compact('data'))->with('message', Session::pull('message', false));
}
示例11: downloadTable
public function downloadTable($id, $year, $month)
{
$contents = "DATA ABSENSI BINA BAKTI\n\n";
$department = Department::find($id);
$contents .= "Unit: ," . $department->name . "\n";
$months = MyDate::get_month_names();
$contents .= "Bulan: ," . $months[$month - 1] . "\n";
$contents .= "Tahun: ," . $year . "\n\n";
$contents .= "KODE,NAMA,NORMAL,,PULANG AWAL,,,TERLAMBAT,LUPA,TUGAS LUAR,,OTHER,TIDAK MASUK,,,JUMLAH HARI MASUK,,JUMLAH HARI TIDAK MASUK,NOMINAL UANG KONSUMSI\n";
$contents .= ",,WEEKDAY,WEEKEND,WEEKDAY < 12,WEEKDAY >= 12,WEEKEND,,,WEEKDAY,WEEKEND,,SAKIT,IZIN,ALPHA,WEEKDAY,WEEKEND,,WEEKDAY,WEEKEND,PULANG AWAL,TOTAL\n";
$employees = Employee::where('department_id', '=', $id)->orderBy('name')->get();
$total = 0;
foreach ($employees as $employee) {
$contents .= $employee->ssn . ",";
$contents .= $employee->name . ",";
$data = Session::pull($employee->id, 'default');
$total += $data['konsumsi_total'];
$contents .= $data['normal_weekday'] . ",";
$contents .= $data['normal_weekend'] . ",";
$contents .= $data['pulang_awal_weekday_before_12'] . ",";
$contents .= $data['pulang_awal_weekday'] . ",";
$contents .= $data['pulang_awal_weekend'] . ",";
$contents .= $data['terlambat'] . ",";
$contents .= $data['lupa'] . ",";
$contents .= $data['tugas_luar_weekday'] . ",";
$contents .= $data['tugas_luar_weekend'] . ",";
$contents .= $data['other'] . ",";
$contents .= $data['sakit'] . ",";
$contents .= $data['izin'] . ",";
$contents .= $data['alpha'] . ",";
$contents .= $data['masuk_weekday'] . ",";
$contents .= $data['masuk_weekend'] . ",";
$contents .= $data['tidak_masuk'] . ",";
$contents .= $data['konsumsi_weekday'] . ",";
$contents .= $data['konsumsi_weekend'] . ",";
$contents .= $data['konsumsi_pulang_awal'] . ",";
$contents .= $data['konsumsi_total'] . ",";
$contents .= "\n";
}
$contents .= ",,,,,,,,,,,,,,,,,,,,," . $total;
// $file_name = "allowance.csv";
$file = public_path() . "/download/allowance.csv";
File::put($file, $contents);
return Response::download($file, "allowance-" . strtolower($department->name) . "-" . $month . "-" . $year . ".csv", array('Content-Type' => 'text/csv', 'Content-Disposition' => 'attachment;'));
}
示例12: onUserLogout
public function onUserLogout($user)
{
if (\Session::has('kandyLiveChatUserInfo')) {
\Session::pull('kandyLiveChatUserInfo');
}
$kandyUser = KandyUsers::where('main_user_id', $user->id)->first();
//if login user is a chat agent
if ($kandyUser) {
$userLogin = KandyUserLogin::where('kandy_user_id', $kandyUser->user_id)->first();
if (!empty($userLogin) && $user->can('admin') == false) {
$userLogin->status = Kandylaravel::USER_STATUS_OFFLINE;
$userLogin->save();
}
if (\Session::has('userAccessToken.' . $kandyUser->user_id)) {
\Session::pull('userAccessToken.' . $kandyUser->user_id);
}
$kandyLaravel = new Kandylaravel();
$full_user_id = $kandyUser->main_user_id . '@' . $kandyUser->domain_name;
$kandyLaravel->getLastSeen([$full_user_id]);
}
}
示例13: prv_buildNotificationAlert
/**
* Build a notification alert
*/
private static function prv_buildNotificationAlert($_type)
{
$strAlerts = '';
$alertClass = $_type == 'error' ? 'danger' : $_type;
$alertIcon = self::$mNotificationIcons[$_type];
$messages = \Session::pull(self::$mSessionPrefix . '.' . $_type, array());
if (empty($messages)) {
return '';
} else {
if (count($messages) == 1) {
$strAlerts = '<span class="title"><i class="fa fa-fw ' . $alertIcon . '"></i>' . trans('notifications.' . $_type) . '</span><p>' . $messages[0] . '</p>';
} else {
$strAlerts = '<span class="title"><i class="fa fa-fw ' . $alertIcon . '"></i>' . trans('notifications.many_notifications') . '</span><p><ul>';
foreach ($messages as $message) {
$strAlerts .= '<li>' . $message . '</li>';
}
$strAlerts .= '</ul></p>';
}
}
return str_replace(array(':message', ':type'), array($strAlerts, $alertClass), self::$mNotificationFormat);
}
示例14: postPartOfForm
public function postPartOfForm()
{
$inputs = Input::all();
$rulesset = array();
if (!array_key_exists('formularArt', $inputs) || !array_key_exists('step', $inputs)) {
$errors = new \Illuminate\Support\MessageBag(['missingFields' => 'missing fields "formArt" and/or "step"']);
Session::forget('formart');
return Response::json(['success' => false, 'errors' => $errors]);
}
$stepData = $inputs;
unset($stepData['formularArt']);
unset($stepData['step']);
unset($stepData['undefined']);
$step = str_replace('-', '', $inputs['step']);
Session::put('formart', $inputs['formularArt']);
try {
$formular = Formular::find(DB::table('formulare')->where('name', $inputs['formularArt'])->first()->id)->firstOrfail();
} catch (Exception $e) {
return Response::json(['success' => false, 'errors' => array($e->getMessage())]);
}
foreach (Formular::find(DB::table('formulare')->where('name', $inputs['formularArt'])->first()->id)->inputrules as $inputrule) {
if (array_key_exists($inputrule->name, $inputs)) {
$rules = [];
foreach ($inputrule->rules as $rule) {
$rules[] = $rule->rule;
}
$rulesset[$inputrule->name] = $rules;
}
}
$v = Validator::make($inputs, $rulesset);
if ($v->fails()) {
return Response::json(['success' => false, 'errors' => $v->errors()->toArray()]);
}
$thisSession = Session::pull('sessionForm');
$thisSession[$step] = $stepData;
Session::put('sessionForm', $thisSession);
return Response::json(['success' => true]);
}
示例15: store
/**
* Store a newly created voucher in storage.
*
* @return Response
*/
public function store($booking_id)
{
$bookings = Session::pull('rate_box_details');
$vouchers = Voucher::arrangeHotelBookingsVoucherwise($bookings, $booking_id);
foreach ($vouchers as $voucher) {
$create_voucher = Voucher::create($voucher);
for ($c = 0; $c < count($voucher) - 6; $c++) {
$voucher[$c]['voucher_id'] = $create_voucher->id;
$voucher[$c]['amount'] = $voucher[$c]['room_cost'];
RoomBooking::create($voucher[$c]);
}
}
Session::forget('add_new_voucher');
// Booking::where('id', $booking_id)->update('user_id', Auth::user()->id);
// $validator = Validator::make($data = Input::all(), Voucher::$rules);
//
// if ($validator->fails())
// {
// return Redirect::back()->withErrors($validator)->withInput();
// }
//
// Voucher::create($data);
return Redirect::route('bookings.show', [$booking_id]);
}