Support the ongoing development of Laravel.io →
Database Views Blade
Last updated 1 year ago.
0

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

Last updated 8 years ago.
0

try

return view('service', ['servicePage' => $servicePage]);

or

return view('service')->with('servicePage', $servicePage);

0

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
0

Sign in to participate in this thread!

Eventy

Your banner here too?

VuHoang vuhoang Joined 5 Apr 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.