{{ link_to_url() }}
{{ link_to_route() }}
{{ link_to_action() }}
you can use any 1 of these
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Greetings,
I have a for each loop that goes through and grabs the Job Number for each job and what I would like to do is generate an HTML link that will show each job. I'm using a resource route to get jobs/{jobs}. I have Illuminate\HTML installed but I'm not sure which HTML::link* to use to define the Job Number as the link.
Here's my Loop
@foreach ($jobs as $job)
<tr>
<td>{{ $job->number }}</td>
</tr>
@endforeach
Here's my Controller that goes through and get's all the jobs
public function index()
{
$jobs = Job::with('customer','steps', 'poles', 'permits')->get();
return view('jobs.home', compact ('jobs'));
}
@foreach ($jobs as $job)
<tr>
<td>{!! app('html')->linkRoute('jobs.show','View Job', $job->number !!}</td>
</tr>
@endforeach
Note: app('html')->linkRoute() is same as HTML::linkRoute().
Please or to participate in this conversation.