如何将 Laravel 7 auth home URL 重定向到仪表板。
我的路由文件 route/web.php
use Illuminate\Support\Facades\Route;
Auth::routes();
Route::get('/dashboard', 'HomeController@index')->name('dashboard');
Route::get('/', function () {
return view('/home');
})->middleware('auth');
MyLogin 控制器看起来像这样
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
protected $redirectTo = RouteServiceProvider::HOME;
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}