return redirect()->action('HomeController@index'); 只需简单传递控制器和动作名到action方法即可。记住,你不需要指定控制器的完整命名空间,因为 Laravel 的RouteServiceProvider将会自动设置默认的控制器命名空间。 return redirect()->action('UserController@profile', [1]); 如果控制器路由要求参数,你可以将参数...
Redirecting To Controller Actions#You may also generate redirects to controller actions. To do so, pass the controller and action name to the action method. Remember, you do not need to specify the full namespace to the controller since Laravel's RouteServiceProvider will automatically set the ...
4. 重定向到控制器动作 returnredirect()->action(‘HomeController@index‘); 只需简单传递控制器和动作名到action方法即可。记住,你不需要指定控制器的完整命名空间,因为 Laravel 的RouteServiceProvider将会自动设置默认的控制器命名空间。 returnredirect()->action(‘UserController@profile‘, [1]); 如果控制器...
Route::get('/', 'HomeController@index'); Route::resource('article', 'ArticleController'); }); }); 不知道哪里出问题了。
Most of the time, when working on the back-end, we need to redirect routes or URLs from the controller while passing query string parameters. Laravel provides a simple way to accomplish this. In the following example, you can see how this can be done. ...
Route::prefix('/admin')->namespace('App\Http\Controllers\Admin\AdminController')->group(function(){ //Admin Login Route Route::get('login', [\App\Http\Controllers\Admin\AdminController::class, 'viewLogin']); Route::post('login', [\App\Http\Controllers\Admin\AdminController::class, 'logi...
I am new to Laravel so I might be missing something really simple. I cannot seem to get redirect to work in a controller to send user to an external website. For example, in a controller I have a function: public function goToGoogle() { $external_uri = 'https://www.google.com';re...
Testing the code on https://github.com/Laravel-Backpack/CRUD/blob/main/src/app/Http/Controllers/MyAccountController.php#L67 Seems that $this->guard()->logoutOtherDevices($request->new_password); fails as if I put a dd after that line is not executed. If I comment that line the redire...
Laravel redirect back : Redirect::back(); is used to redirect back the users from the current url to the back url. Here in this tutorial we are going to explain how you can redirect from current url to back url with errors in laravel. ...
In Laravel's Auth system you can customize a few most important things - one of them is a variable $redirectTo - where to take the user after login/registration. But there's even more to customize. By default, our app/Http/Controllers/Auth/RegisterController.php has this variable: ...