Reputation: 145
I have app in Laravel and Vue.js. In navbar.blade.php I did something like this:
<p>{!! $test !!}</p>
Now I want to change that variable to text using only routing. Can I do it? How?
If not, how I can keep that variable but change it in vue.js?
Upvotes: 0
Views: 218
Reputation: 1203
As per your comment,
I have navbar and I include it in my components. Now I want to have different text on all pages.
I think you can make use of Blade yield
. I'm assuming you are using Blade extends
Change your <p>
tag in your nav components
from
<p>{!! $test !!}</p>
To
<p>@yield('testValue')</p>
and in every page, add this after @extends(....)
@section('testValue', 'MyValueSpecificToThisPage')
Hope it's helpful.
Upvotes: 0
Reputation: 719
you can try like
Route::get('path/{test}', function ($test) {
return view('viewblade', ['test' => $test]);
});
Hope these will Help.
Upvotes: 1