S
S
Speakermen2021-03-05 12:18:25
Laravel
Speakermen, 2021-03-05 12:18:25

How to fix UrlGenerationException?

Good day dear programmers. I installed breeze, but when setting it up for myself, I ran into difficulty, I can’t find RouteServiceProvider::HOME and change 'dashboard' to Auth::id()

public function store(LoginRequest $request)
    {
        $request->authenticate();

        $request->session()->regenerate();

        //return redirect()->intended(RouteServiceProvider::HOME);
        return redirect('/id' . Auth::id());
    }


Shows an error that id is not defined, I just need a redirect to id1

Route::get('/id{id}', function ($id) 
{
    return view('profile');
})->where('id', '[0-9]+')->middleware(['auth'])->name('dashboard');


And I can't understand what kind of syntax is such an alternative and can I change it to regular html? ( x-slot x-dropdown-link

<x-slot name="content">
                        <!-- Authentication -->
                        <form method="POST" action="{{ route('logout') }}">
                            @csrf

                            <x-dropdown-link :href="route('logout')"
                                    onclick="event.preventDefault();
                                                this.closest('form').submit();">
                                {{ __('Log out') }}
                            </x-dropdown-link>
                        </form>
                    </x-slot>


Can't I pass a parameter (props) to a function to use in route('dashboard')?

Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: dashboard] [URI: id{id}] [Missing parameter: id]. (View: D:\install\OpenServer\domains\laravel8api.local\resources\views\profile.blade.php)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
netrox, 2021-03-05
@Speakermen

Route::get('/id/{id}');

return redirect('/id/' . Auth::id());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question