本文整理汇总了PHP中Session::forget方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::forget方法的具体用法?PHP Session::forget怎么用?PHP Session::forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::forget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postAdd
public function postAdd()
{
$title = 'Proceso de daño';
$cart = array();
$input = Input::all();
if (Session::has('cart')) {
$cart = Session::get('cart');
}
if (empty($cart)) {
return Redirect::to('damages');
}
foreach ($cart as $item) {
$check = Article::checkStock($item['article'], $input['branch_id'], $item['amount'], 'daño');
/*Comprueba si hay suficiente stock en la sucursal*/
if ($check != 'Ok') {
Session::flash('message', $check);
return Redirect::to('cart');
}
}
/*Crea el registro en la tabla damages*/
self::saveInDamageTable();
/*Crea los registros en la tabla damage_items*/
foreach ($cart as $item) {
self::saveInDamageItemTable($item['article']->id, $item['amount']);
}
#foreach $cart as $item
/*Vacía el carrito*/
Session::forget('cart');
return Redirect::to('damages');
}
示例2: startIndexAction
/**
* Start test
*/
public function startIndexAction()
{
Assets::reset()->add('main');
$token = $this->getToken();
if (!$token) {
return Redirect::route('info')->with('message', 'Токен не найден');
}
if ($token->status == Token::TOKEN_STATUS_EMPTY) {
/**
* вывести форму где пользователь введёт свои данные
*/
$departments = Department::all();
$groups = Group::all();
$selectedDepartments = array();
$selectGroups = array();
$selectedDepartments[] = 'Не выбран';
$selectGroups[] = 'Не выбран';
foreach ($departments as $department) {
$selectedDepartments[$department->id] = $department->name;
}
foreach ($groups as $group) {
$selectGroups[$group->id] = $group->name;
}
return View::make('test.start', ['token' => $token, 'departments' => $selectedDepartments, 'groups' => $selectGroups]);
} elseif ($token->status == Token::TOKEN_STATUS_STARTED) {
if ($this->isTokenValid($token)) {
return Redirect::route('test.index');
} else {
Session::forget('token_string');
$token->status = Token::TOKEN_STATUS_EXPIRED;
$token->save();
return Redirect::route('info')->with('message', 'Время теста истекло');
}
}
}
示例3: logout
public function logout()
{
Session::forget('ltime');
Session::forget('sescode');
Auth::logout();
return Response::json(array('flash' => 'Logged Out !'));
}
示例4: postAdd
public function postAdd()
{
$title = 'Proceso de entrega inmediata';
$cart = array();
$input = Input::all();
$idBranch = Auth::user()->roles()->first()->branch->id;
if (Session::has('cart')) {
$cart = Session::get('cart');
}
if (empty($cart)) {
return Redirect::to('instants');
}
foreach ($cart as $item) {
$check = Article::checkStock($item['article'], Auth::user()->roles()->first()->branch->id, $item['amount'], 'entrega inmediata');
/*Comprueba si hay suficiente stock en la sucursal*/
if ($check != 'Ok') {
Session::flash('message', $check);
return Redirect::to('cart');
}
}
/*Crea el registro en la tabla instants*/
self::saveInInstantTable();
/*Crea los registros en la tabla instant_items*/
foreach ($cart as $item) {
self::saveInInstantItemTable($item['article']->id, $item['amount']);
}
#foreach $cart as $item
/*Disminuye el campo stock en la tabla stocks*/
$instant_id = Instant::first()->orderBy('created_at', 'desc')->first()->id;
self::saveInInstantStore($instant_id);
/*Vacía el carrito*/
Session::forget('cart');
return Redirect::to('instants');
}
示例5: logout
/**
* @return \Illuminate\Http\RedirectResponse
* @throws \Dvlpp\Sharp\Exceptions\MandatoryClassNotFoundException
*/
public function logout()
{
$authService = SharpSiteConfig::getAuthService();
$authService->logout();
Session::forget("sharp_user");
return redirect()->to("/");
}
示例6: Login
public function Login()
{
$user = Input::get('username');
$pass = Input::get('password');
$validar_ldap = $this->ValidarLDAP($user, $pass);
switch ($validar_ldap) {
case "ERROR_LOGIN":
Session::put('error', 'Login Incorrecto');
Session::forget('username');
break;
case "ACCESO_NEGADO":
Session::put('error', 'Acceso Denegado');
Session::forget('username');
break;
default:
Session::forget('error');
Session::put('username', $validar_ldap);
$userinfo = explode("|", $validar_ldap);
$nickname = $userinfo[1];
Session::put('NickNameUsuario', $nickname);
Session::put('activity', time());
break;
}
if (Session::get('username') && Session::get('username') != '') {
return Redirect::route('index');
} else {
return Redirect::route('login', array('error' => Session::get('error')));
}
}
示例7: getLogout
public function getLogout()
{
Session::forget("logined");
Session::forget("role");
//Xóa session đăng nhập
return Redirect::to("/");
}
示例8: login
/**
* Process login, only for POST http method
*
* @return \Illuminate\Http\RedirectResponse
*/
public function login()
{
/**
* Get input values
*/
$credentials = array('username' => Input::get('username'), 'password' => Input::get('password'));
/**
* Get remember me checkbox value ('on' or null)
*/
$rememberme = Input::get('rememberme', false);
/**
* Check username or password is not empty
*/
if ($credentials['username'] == '' or $credentials['password'] == '') {
return Redirect::route('login')->withInput(Input::except('password'))->with('error', 'Username or password cannot be blank');
}
/**
* Attempt to authenticate
*/
if (Auth::attempt($credentials, $rememberme)) {
/**
* Get session variable 'redirect' for previous page
*/
if ($url = Session::get('redirect', false)) {
Session::forget('redirect');
return Redirect::to($url);
}
return Redirect::refresh();
}
/**
* If authentication failed, redirect to login page
*/
return Redirect::route('login')->withInput(Input::except('password'))->with('error', 'Wrong username or password');
}
示例9: postNueva
public function postNueva()
{
try {
if (!Session::has('cliente')) {
Session::flash('mensajeError', 'Debes seleccionar un cliente para continuar.');
return Redirect::to('carrito');
}
$input = Input::all();
$cotizacion = new Cotizacion();
$cotizacion->cliente_id = Session::get('cliente')->id;
$cotizacion->concepto = $input['concepto'];
$cotizacion->notas = $input['notas'];
$cotizacion->user_id = Auth::user()->id;
$cotizacion->save();
if (self::guardarItems($cotizacion->id) === false) {
$cotizacion->delete();
Session::flash('mensajeError', 'No fue posible guardar la cotización por uno de sus items.');
return Redirect::to('carrito');
}
Session::forget('carrito');
Session::forget('cliente');
Session::flash('mensajeOk', 'Has creado la cotizacion ' . $cotizacion->id . ' con éxito.');
return Redirect::to('cotizaciones/filtro-por-id/' . $cotizacion->id);
} catch (Exception $e) {
Session::flash('mensajeError', 'No fue posible guardar la nueva cotización.');
return Redirect::to('carrito');
}
}
示例10: saveProduct
public function saveProduct()
{
$data = Input::all();
if (!Auth::guest()) {
$validator = Validator::make($data, Product::$rules);
if ($validator->passes()) {
$user = Auth::user();
$product = new Product();
$product->user_id = $user->id;
$product->product_name = $data['product_name'];
$product->description = $data['description'];
$product->start_price = $data['start_price'];
$product->save();
if (isset($data['categories']) && !empty($data['categories'])) {
$product->categories()->attach($data['categories']);
}
if (Session::has('files')) {
$files = Session::get('files');
// get session files
foreach ($files as $key => $file) {
$directory_file = public_path() . '/product_images/' . $file;
if (File::exists($directory_file)) {
File::move($directory_file, public_path() . '/product_images/product_' . $product->id . '_' . $key . '.jpg');
}
}
Session::forget('files');
}
return Response::json(array('success' => true, 'product' => $product));
}
return Response::json(array('success' => false, 'type' => 'form_error', 'errors' => $validator->messages()));
}
return Response::json(array('success' => false, 'type' => 'log_error', 'error' => 'In order to save your product, please, log in!'));
}
示例11: getLogout
function getLogout()
{
Session::forget('username');
Session::forget('password');
Auth::logout();
return Redirect::to('/login');
}
示例12: lock
public function lock()
{
$prevURL = URL::previous();
if (Request::ajax()) {
$admin = Auth::admin()->get();
if (!Input::has('password')) {
$message = 'You must enter password to re-login.';
} else {
if (Hash::check(Input::get('password'), $admin->password)) {
Session::forget('lock');
Session::flash('flash_success', 'Welcome back.<br />You has been login successful!');
return ['status' => 'ok'];
}
$message = 'Your password is not correct.';
}
return ['status' => 'error', 'message' => $message];
} else {
if (Request::isMethod('get')) {
Session::put('lock', true);
}
}
if (empty($prevURL) || strpos($prevURL, '/admin/lock') !== false) {
$prevURL = URL . '/admin';
}
return Redirect::to($prevURL);
}
示例13: logout
public static function logout()
{
Session::forget("auths");
Cookie::forget(Config::get('auth.rememeber_cookie'));
//
//Url::redirect("@".Config::get('auth.login'));
}
示例14: postAdd
public function postAdd()
{
$title = 'Proceso de rotación';
$cart = array();
$input = Input::all();
if (Session::has('cart')) {
$cart = Session::get('cart');
}
if (empty($cart)) {
return Redirect::to('rotations');
}
foreach ($cart as $item) {
$check = Article::checkStock($item['article'], $input['branch_from'], $item['amount'], 'rotación');
/*Comprueba si hay suficiente stock en la sucursal*/
if ($check != 'Ok') {
Session::flash('message', $check);
return Redirect::to('cart');
}
}
/*Crea el registro en la tabla rotations*/
self::saveInRotationTable();
/*Crea los registros en la tabla rotation_items*/
foreach ($cart as $item) {
self::saveInRotationItemTable($item['article']->id, $item['amount']);
}
#foreach $cart as $item
/*Vacía el carrito*/
Session::forget('cart');
return Redirect::to('rotations/filter-by-status?estado=pendiente%');
}
示例15: getLogout
public function getLogout()
{
if (Session::has('kukki_user')) {
Session::forget('kukki_user');
return Redirect::to('site/login');
}
}