JellyBool

17773 经验值

在 Controllers\Auth\AuthController :

 public function postLogin(Request $request)
    {
        $this->validate($request, [
            $this->loginUsername() => 'required', 'password' => 'required',
        ]);

        // 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);
        }

        $credentials = $this->getCredentials($request);

        if (Auth::attempt($credentials, $request->has('remember'))) {
            // 这里写你的登录时间记录
            return $this->handleUserWasAuthenticated($request, $throttles);
        }

        // 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($this->loginPath())
            ->withInput($request->only($this->loginUsername(), 'remember'))
            ->withErrors([
                $this->loginUsername() => $this->getFailedLoginMessage(),
            ]);
    }

这是正常的啊,你限制了唯一,然后你又想创建两条在这个字段一样的记录。。

11111111111

你更新的这个值应该数据库已经有了

试试这样:

$this->validate($request,[
                'name' => ‘required|unique:users,name,'.Auth::id(),
]);
// 就是在添加的时候加上 Auth::id(),排除验证这一行

这样?

$this->validate($request,[
                'name' => ‘required|unique:users',
]);

这样的应用场景推荐使用 route:


Route::group(['prefix'=>'admin'], function () {
    Route::get('/user',['as' => 'admin', function () {
        
    }]);
});

这个时候:

<a href="{ route('admin') }"></a> 
// 包含 admin

或者你一定要使用 url 的话,试试这样:

{ url('admin', 'user') }

你确定你照着写了?代码贴出来看看?

估计就是哪里忘记了 return 吧

这个配置就是这样的啊,一路都有讲到,你是跳着看视频?

或者你也可以看这个

https://www.laravist.com/series/laravel-and-front-end-series

试试重新下载 node_modules 里面的内容

貌似是 isarray 这个没有加载

恩哼?这个具体说的是哪个部分?链接我看看?