Laravel:未定义的变量:请求

时间:2017-10-20 17:42:05

标签: laravel login request

我找不到问题。它在哪里? “未定义的变量:请求”

public function login()
{
  // Validate the form data
  $this->validate($request, [
    'email' => 'required|email',
    'passwort' => 'required|min:6'
  ]);

  // Attempt to log the user in
  if (Auth::guard('admin')->attempt(['email' => $request->email, 'passwort' => $request->passwort], $remember)) {
    // if successful, then redirect to their intended location
    return redirect()->intended(roue('admin.dashboard'));
  }

  // if unsuccessful, then redirect back to the login with the form data
  return redirect()->back()->withInput($request->only('email', 'remember'));
}

2 个答案:

答案 0 :(得分:4)

您需要注入#!/usr/bin/python3 from scapy.all import * from queue import Queue from multiprocessing import Process queue = Queue() class Producer(Process): def run(self): global queue print("Starting producer thread") sniff(iface="wlan1mon", store=0, prn=pkt_callback) def pkt_callback(pkt): queue.put(pkt) print(queue.qsize()) class Consumer(Process): def run(self): global queue while True: pkt = queue.get() queue.task_done() if pkt.haslayer(Dot11): print("**Packet with Dot11 layer has been processed") else: print("--Packet without Dot11 layer has been processed") if __name__ == '__main__': Producer().start() Consumer().start() 对象:

Request

另外,将此行添加到班级的顶部:

public function login(Request $request)

或者,您可以在代码中使用use Illuminate\Http\Request; 代替request()

答案 1 :(得分:1)

您尚未定义'request'变量,但您在代码中使用它。

已编辑的代码

public function login(Request $request)
{
  // Validate the form data
  $this->validate($request, [
    'email' => 'required|email',
    'passwort' => 'required|min:6'
  ]);

  // Attempt to log the user in
  if (Auth::guard('admin')->attempt(['email' => $request->email, 'passwort' => $request->passwort], $remember)) {
    // if successful, then redirect to their intended location
    return redirect()->intended(roue('admin.dashboard'));
  }

  // if unsuccessful, then redirect back to the login with the form data
  return redirect()->back()->withInput($request->only('email', 'remember'));
}

另外,将此行添加到班级的顶部:

use Illuminate\Http\Request;