App/Http/Middleware/RedirectAuthenticated.phpを編集します。
namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\Auth; class RedirectIfAuthenticated { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { // return redirect('/home'); return redirect('/top'); } return $next($request); } }
TopController.phpをつくります。
namespace App\Http\Controllers; use Illuminate\Http\Request; class TopController extends Controller { /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('auth'); } /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function index() { return view('top'); } }
上手くいくようになりました。