Thursday, April 12, 2018

Missing required parameters for route, multiple parameter statement - development

Missing required parameters for route, multiple parameter statement

I have encountered a problem, it seems i’m missing ‘slug’from the link, if i put in that $slug i get an undefined variable, any ideas on how i should define the slug in that button?
Missing required parameters for [Route: thread.show] [URI: forum/{slug}/t={id}].

Controller:

 public function show($slug)
    {
        //
        $forum = Forum::where('slug', '=', $slug)->first();
        $thread = Thread::all()->sortBy('created_at');
    return view('forum.show')->with('forum', $forum)->withThread($thread);
}

view:

           @foreach($forum->threads as $threads)
            <a href=""><p></p></a>
           @endforeach



from Laravel Questions and Answers https://laravelquestions.com/laravel/missing-required-parameters-for-route-multiple-parameter-statement/
via Lzo Media

No comments:

Post a Comment