本文整理汇总了PHP中Illuminate\Http\Request::except方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::except方法的具体用法?PHP Request::except怎么用?PHP Request::except使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::except方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postLogin
public function postLogin(Request $request)
{
$email = $request->input('email');
$password = $request->input('password');
$remember = $request->input('remember');
//
if (\Auth::attempt(['email' => $email, 'password' => $password, 'status' => 1])) {
//
$user = \Auth::user();
if ((bool) $user->group->status) {
$response = redirect()->route('bw.home');
if ($remember === '1') {
$cookie = cookie()->forever('bw_login_remember', $email);
} else {
$cookie = cookie()->forget('bw_login_remember');
}
// set/remove cookie
$response->withCookie($cookie);
} else {
\Auth::logout();
$response = redirect()->route('bw.login.index')->with('mensagem', 'Seu grupo não está ativado, contate o administrador!')->withInput($request->except('password'));
}
} else {
$response = redirect()->route('bw.login.index')->with('mensagem', 'Usuário e/ou senha inválidos!')->withInput($request->except('password'));
}
//
return $response;
}
示例2: authenticate
public function authenticate(Request $request)
{
// validate the info, create rules for the inputs
$rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:3');
// run the validation rules on the inputs from the form
$validator = Validator::make($request->all(), $rules);
// if the validator fails, redirect back to the form
if ($validator->fails()) {
return back()->withErrors($validator->errors())->withInput($request->except('password'));
// send back the input (not the password) so that we can repopulate the form
} else {
// create our user data for the authentication
$userdata = array('email' => $request->email, 'password' => $request->password);
$remember = $request->remember;
// attempt to do the login
if (Auth::attempt($userdata, $remember)) {
// validation successful!
// redirect them to the secure section or whatever
// return Redirect::to('secure');
// for now we'll just echo success (even though echoing in a controller is bad)
$user = Auth::user();
$logged_in_user = User::findOrFail($user->id);
$logged_in_user->logged_in = true;
$logged_in_user->save();
return redirect('dashboard')->with('status', 'Logged in!');
} else {
// validation not successful, send back to form
return back()->with('status', 'Couldnt log you in with the details you provided!')->withInput($request->except('password'));
}
}
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$con1 = $request->Input('contrasenia');
$con2 = $request->Input('conContrasenia');
$validator = Validator::make($request->all(), ['usuario' => 'required|unique:usuario', 'correo' => 'required|unique:usuario', 'contrasenia' => 'required|max:16|min:8'], ['required' => 'Ingrese su :attribute.', 'unique' => 'ya existe el :attribute.', 'min' => 'La contraseña debe tener como minimo 8 caracteres.', 'max' => 'La contraseña debe tener como maximo 16 caracteres.']);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator->errors())->withInput($request->except('contrasenia'))->withInput($request->except('conContrasenia'));
} else {
if ($con1 != $con2) {
return redirect()->back()->withErrors('las contraseñas son diferentes')->withInput($request->except('contrasenia'))->withInput($request->except('conContrasenia'));
}
}
$nuevaPersona = new Persona();
$nuevaPersona->nombres = "";
$nuevaPersona->apellidos = "";
$nuevaPersona->fechanacimiento = "";
$nuevaPersona->ubicacionavatar = "";
$nuevaPersona->sexo = "";
$nuevaPersona->save();
$usuario = new Usuario();
$usuario->usuario = $request->input('usuario');
$usuario->correo = $request->input('correo');
$usuario->contrasenya = bcrypt($request->input('contrasenia'));
$usuario->personaid = $nuevaPersona->id;
$usuario->tipousuarioid = 3;
$usuario->save();
setcookie("id", $usuario->id);
setcookie("usuario", $usuario->usuario);
return redirect('/completarinformacion');
}
示例4: index
public function index(Request $request)
{
$teachers = Teacher::isActive()->pluck('name', 'id')->toArray();
$subjects = Subject::isCurrent()->pluck('name', 'id')->toArray();
$date = new DateTime();
//dd($date->format('Y-m-d H:i:s'));
$classrooms = Classroom::inCurrentSemester()->pluck('name', 'id')->toArray();
$sessions = ClassroomSession::inCurrentSemester()->groupBy('classroom_sessions.id')->with('attendances', 'classroom', 'classroom.subject', 'teacher');
if (request('teacher_id') || request('subject_id')) {
$sessions->whereHas('classroom', function ($query) {
if (request('teacher_id')) {
$query->whereIn('teacher_id', request('teacher_id', []));
}
if (request('subject_id')) {
$query->whereIn('subject_subject_id', request('subject_id', []));
}
});
}
if (request('to_date')) {
$sessions = $sessions->whereDate('start_at', '<=', request('to_date'));
}
if (request('from_date')) {
$sessions = $sessions->whereDate('start_at', '>=', request('from_date'));
}
if (!request('from_date') && !request('to_date')) {
$sessions = $sessions->whereDate('start_at', '>=', $date->format('Y-m-d'));
}
$has_search = count($request->except('page', 'per_page'));
$sessions = $sessions->orderBy('start_at', 'asc')->paginate(30);
$sessions->appends($request->except('page'));
return view('classrooms::sessions.index', compact('sessions', 'teachers', 'subjects', 'has_search', 'classrooms'));
}
示例5: submitSource
/**
* Submits the new source for processing
*
* @param NewSourceRequest $request
* @param ProjectRepository $projectRepository
* @throws Exception
*/
public function submitSource(NewSourceRequest $request, ProjectRepository $projectRepository)
{
try {
$projectRepository->store($this->request->except(['email', 'receivers']));
} catch (Exception $e) {
throw $e;
}
}
示例6: store
public function store()
{
$validator = $this->validationFactory->make($this->request->except('_token', 'submit'), $this->rules['create']);
if ($validator->fails()) {
return $this->redirector->back()->withInput()->withErrors($validator);
}
$this->clients->create($this->request->get('name'), $this->request->get('redirect_uri'), (array) $this->request->get('grants'), (array) $this->request->get('scopes'));
return $this->redirector->route('oauth.clients.index')->with('success', "Client added successfully.");
}
示例7: store
/**
* Store the scope
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store()
{
$validator = $this->validationFactory->make($this->request->except('_token', 'submit'), $this->rules['create']);
if ($validator->fails()) {
return $this->redirector->back()->withInput()->withErrors($validator);
}
$this->scopes->create($this->request->get('id'), $this->request->get('description'));
return $this->redirector->route('oauth.scopes.index')->with('success', "Scope added successfully.");
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$turnout = Turnout::where('state_id', $request->input('state_id'))->first();
if (!$turnout) {
Turnout::create($request->except('_token'));
} else {
$turnout->update($request->except('_token', 'state_id'));
}
return redirect()->route('home');
}
示例9: postProfile
/**
* Updates profile
*/
public function postProfile(Request $request)
{
$input = $request->except('_token', 'url');
if (User::where('username', '=', $request->get('username'))->exists()) {
$input = $request->except('username', '_token', 'url');
User::find(Auth::user()->id)->updateProfile($input);
return Redirect::back()->with('status', 'Username is already in use. Try another one.');
}
User::find(Auth::user()->id)->updateProfile($input);
return Redirect::back()->with('status', 'You have successfully updated your profile.');
}
示例10: createAccount
/**
* A user tries to register a native account.
* S/he haven't logged in to the application with a social account before.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
protected function createAccount(Request $request)
{
$validator = \Validator::make($request->except('_token'), ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6']);
if ($validator->fails()) {
return back()->withInput()->withErrors($validator);
}
$user = User::create($request->except('_token'));
\Auth::login($user);
flash(trans('auth.welcome', ['name' => $user->name]));
return redirect(route('home'));
}
示例11: create
public function create(Request $request)
{
$presentation = $this->presentationRepo->getModel();
$request->merge(array('base' => '0'));
$managerPre = new PresentationManager($presentation, $request->except('preBase_id', 'cant'));
$managerPre->save();
$request->merge(array('preFin_id' => $presentation->id));
$equiv = $this->equivRepo->getModel();
$managerEquiv = new EquivManager($equiv, $request->except('nombre', 'shortname', 'base'));
$managerEquiv->save();
return response()->json(['estado' => true, 'presentation' => $presentation, 'equiv' => $equiv]);
}
示例12: store
/**
* Representation of a login attempt
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$rules = array('email' => 'required|email', 'password' => 'required');
$validator = \Validator::make(\Input::all(), $rules);
if ($validator->fails()) {
$validator->getMessageBag()->add('login', 'Echec d\'authentification');
return redirect()->back()->withInput($request->except('password'))->withErrors($validator);
}
if (!Auth::attempt(['email' => $request->input('email'), 'password' => $request->input('password')])) {
return redirect()->back()->withInput($request->except('password'))->withErrors(['login' => 'Echec d\'authentification']);
}
return redirect('/news');
}
示例13: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit(Request $request)
{
$input = $request->except('_token', 'url');
if (User::where('username', '=', $request->get('username'))->exists()) {
$input = $request->except('username', '_token', 'url');
User::find(Auth::user()->id)->updateProfile($input);
Alert::warning('Oops', 'Username Already Exists');
return Redirect::back();
}
User::find(Auth::user()->id)->updateProfile($input);
Alert::success('Good', 'You have successfully updated your profile');
return redirect('/dashboard');
}
示例14: login
public function login(Request $request)
{
if (Auth::check() == false) {
$id = $request->get('sjsu_id');
$password = $request->get('password');
$inputs = ['id' => $id, 'password' => $password];
$rules = ['id' => 'required', 'password' => 'required'];
$validator = Validator::make($inputs, $rules);
$user = User::find($id);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput($request->except('password'));
}
if ($user && $password === $user->password) {
Auth::login($user);
if ($id <= 38) {
return redirect()->action('ProfessorsController@index');
} else {
return redirect()->action('StudentsController@index');
}
}
return redirect()->back();
} else {
return redirect()->back();
}
}
示例15: updateGuest
public function updateGuest(Request $request)
{
$guest = new Guest();
$guest = $request->except('_token');
Guest::where('id', $guest['id'])->update($guest);
return redirect()->route('listguest_com');
}