Good morning Sirs. I have a question about the route in Laravel, I have done searches trying to find the result but I did not find what I wanted.
I need that from the id that is redirected (for example: / discipline / 3) it sends the number "3" to the parameter of my method return_disciplina ($ id) so that I can work with it. I tried to do as below but nothing worked out so far. What should I do?
Thank you
Code in the web.php file
Route::get('/disciplina/{id}', "select@retorna_disciplina(id)")->middleware('login');
Code not controller
public function retorna_disciplina($id)
{
$prontuario = session('prontuario');
$cargo = session('cargo');
if($cargo == "P")
{
$disciplina = DB::table('oferecimento_disciplina')
->where('id_professor','=', $prontuario)
->where('dsa', '=', $id)
->first();
if(count($disciplina)>0)
{
$postagens = DB::table('postagens')
->where('dsa', '=', $id)
->get();
return view('disciplinas.disciplina')->with([
'disciplina' => $disciplina,
'postagens' => $postagens
]);
}
else{
Redirect::to('/perfil')->withErros("A disciplina não existe ou você não tem permissão de acesso");
}
}
}