Hi, Alex,
I need help for episode #21, there's an exception "undefined variable $href"
I have put below code in "employee-show.blade.php"
<div class="space-y-10">
<div>
<h2 class="text-xl font-medium">Choose a service from {{ $employee->name }}</h2>
<div class="grid grid-col-2 md:grid-cols-5 gap-8 mt-6">
@foreach($employee->services as $service)
<x-service :href="route('checkout', [$service, $employee])" :service="$service" />
@endforeach
</div>
</div>
</div>
and in the service.blade.php i have put code like this
<a href="{{ $href }}" class="py-8 px-4 border border-slate-200 rounded-lg shadow-sm flex flex-col items-center justify-center text-center hover:bg-gray-50/75">
<div class="text-sm font-medium mt-3 text-slate-600">
{{ $service->title }}
</div>
<div class="text-sm font-medium mt-1 text-slate-400">
{{ $service->duration }} minutes
</div>
<div class="text-xs font-medium mt-3 text-slate-600 bg-slate-200 rounded-lg py-0.5 px-1.5">
{{ $service->price }}
</div>
</a>
I also have checked the code in github repository and everything is same.
Hello @riocahya, did you manage to fix the issue?
If not, modify service.blade.php to include @props at the top:
@props(['href', 'service'])
Also pass the :service
variable to the
x-service component
since you're using it within that component.
and let me know how it goes :)