Path with Laravel URL parameters

Asked

Viewed 33 times

0

It’s a silly question, but I’m racking my brain.

I have the url

subcategory/sessao/3/1/Facirolli04

where they are as follows,

3 - would be the category

1 - would be the session

Facirolli04 - would be the product

My controller is as follows

public function sessao($caregoria_id, $id, $nome)
{
    
    $categorias = Categorias::select()->get();
    $produtos = Produtos::select()
                    ->where('sessao_id', $id)
                    ->with('categoria')
                    ->with('sessao')
                    ->inRandomOrder()
                    ->paginate($this->totalPaginas);
    

    $sessoes = Sessoes::select()->where('categoria_id', $nome)->get();
    return view('home.sessao', compact('categorias', 'produtos', 'sessoes'));

My route

$this->get('produtos/subcategoria/sessao/{categoria_id}/{id}/{nome}', 'Site\SiteController@sessao')->name('site.home.sessao');

Where can I be missing, because it retrieves {id} and {name} but not {categoria_id}

Thanks in advance!

1 answer

1


It’s a typo. Note that in the method declaration in the controller you have: $caregoria_id instead of $categoria_id

  • Salvador @joaopedrohenrique guy after spending all afternoon wanting to fix this... was a silly mistake... thank you so much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.