0

I have a titles index page (displays many titles via foreach loop) and a single title show page. On the single title show page I want to be able to show a person's info page, ie. actors page. I really have no idea how to make that happen as I'm new to Laravel. I have tried laravel routing docs, non seems to talk about what I want to achieve. I know this is dificult as I don't have a clear enough question. Anyways this is what I tried so far: For titles I used resource controller as bellow

    Route::resources([
    'titles' => 'TitlesController',
]);

And for the director I used the followinf code

    Route::get('/director', function(Title $title)
{
    $title = Title::find($title->director()->first()->id);

    return view('people.actor', [ 'title'=>$title ]);
});

In my title show page I used the folllowing url to go to the directors page

 <a href="./title/{$title->director()->first()->id}">

   <h4>{{ $title->director()->first()->name }} </h4>
 </a>

the name is displaying as expected. I'm I taking the right approach? Is there any related documentation? what should I do? Again, sorry for asking asking such a compicated question Bellow is the title viw as shown in browser. Hope someone understands what I'm tryinna do. Thanks. enter image description here

Mapalo PS
  • 1
  • 2

1 Answers1

0

I figured out what the problem was.. Just changed <a href="./title/{$title->director()->first()->id}"> and replaced it with <a href="./director/{$title->id}">

Mapalo PS
  • 1
  • 2