Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
111 views
in Technique[技术] by (71.8m points)

php - Laravel 8 view does not update routing

Hello I developing simple website. Recently I added auth(register/login) system. The problem is that when I log in to my user the routing goes to previously created route "/backend" even though I created new route called "/checkUser". I tried to clear all kind of cache but it did not work.

login.blade.php login button fragment:

<div class="form-group">
    <div class="form-group">
        <button href="{{ url('/checkUser') }}" 
        type="submit" class="btn btn-primary btn-user btn-block">
            {{ __('Login') }}
        </button>
    </div>
</div>

web.php:

<?php

use IlluminateSupportFacadesRoute;
use IlluminateSupportFacadesAuth;
use AppHttpControllersackendController;


Route::get('/', function () {
    return view('welcome');
});
Route::get('/checkUser', [backendController::class, 'userCheck']);
Auth::routes();

Route::get('/home', [AppHttpControllersHomeController::class, 'index'])->name('home');

backendController.php:

public function userCheck()
    {
        $userRoles = Auth::user()->roles->pluck('name');
        dd($userRoles);

    }
question from:https://stackoverflow.com/questions/65865366/laravel-8-view-does-not-update-routing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Found the answer! Needed to check routes and find "login"

php artisan route:list

In my case scenario I changed HOME directory to "/backend"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...