Your variable $service_name is not set, since you don't pass it in the function like this
public function service($service_name) { ... }
$service_name laso is supposed to be in your routes.php, if you are going to used it that way
try
return view('service', ['servicePage' => $servicePage]);
or
return view('service')->with('servicePage', $servicePage);
Thanks for the feed back, i have figured it out how to do it .
I have changed my controller into this
public function service()
{
$service = Service::get();
return view('service', ['services' => $service]);
}
and this is what i have in my view
@foreach ($services as $i)
<h3>{{ $i->service_name }}</h3>
<p>{!!$i->service_content!!}</p>
@endforeach
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community