方法 Illuminate\Routing\Redirector::round 不存在

Method Illuminate\Routing\Redirector::round does not exist

这是我的控制器的样子:

    <?php

namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class UserController extends Controller
{

public function getDashboard(){
    return view('dashboard');
}


public function getRegistration(){
    return view('pages.registration');
}

public function getLogin(){
    return view('pages.login');
}

    public function registration (Request $request){


        $name = $request['name'];
        $email = $request['email'];
        $password = bcrypt($request['password']);

        $user = new User();
        $user->name = $name;
        $user->email = $email;
        $user->password = $password;
        $user->save();
        return redirect()->route('login');

    }

    public function Login (Request $request){


            if(Auth::attempt(['email' => $request['email'], 'password' => $request['password']]))
            {
                return redirect()->round('dashboard');
            }
            else
            {
            return redirect()->route('registration');
            }
}
}

这是我的登录方式:

<body style="background-image:url({{url('resources/views/img/cloud.jpg')}}">

    <div class="container">
            <div class="row main">

                <div class="main-login main-center">
                    <form class="form-horizontal" method="post" action="{{route('login')}}">

                        <h2 style="text-align: center;"> Login </h2>
                        <br />
                        <div class="form-group">
                            <div class="cols-sm-10">
                                <div class="input-group">
                                    <span class="input-group-addon"><i class="fa fa-envelope fa" aria-hidden="true"></i></span>
                                    <input type="text" class="form-control" name="email" id="email"  placeholder="Enter your Email"/>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="cols-sm-10">
                                <div class="input-group">
                                    <span class="input-group-addon"><i class="fa fa-lock fa-lg" aria-hidden="true"></i></span>
                                    <input type="password" class="form-control" name="password" id="password"  placeholder="Enter your Password"/>
                                </div>
                            </div>
                        </div>

                        <button type="submit" class="btn btn-primary btn-lg btn-block login-button">Login</button>

                        <input type="hidden" name="_token" value="{{Session::token()}}">


                        <div class="login-register">
                           <p> Don't Have any Account?<a href="{{url ('/registration')}}"><b> Register Here</b></a></p>
                         </div>
                    </form>
                </div>
            </div>
        </div>
</body>

我收到此错误:方法 Illuminate\Routing\Redirector::round 不存在。 因为我是 laravel 的新手,所以我什至不明白这个错误,我找不到与此相关的任何答案。我想我错过了一些东西,但我无法弄清楚。如果有人知道,请 post 回答 :)

您写的是 redirect()->round('dashboard'); - 您是指 redirect()->route('dashboard'); 吗?

错误是因为您试图访问一个不存在的方法。

所以尝试改变这个:

return redirect()->round('dashboard');

进入这个:

return redirect()->route('dashboard');

从控制器重定向

i) 所以试试这个方法:

function View(){ 
 $user="hello";
 return redirect('view')->back()->with('user');
}

ii) 创建路线

Route::get('view',function($user){
 return $user."world";
 })->name('view');