P
P
Petya Fox2019-06-22 03:46:45
Laravel
Petya Fox, 2019-06-22 03:46:45

How to display turbo pages in Laravel?

I generated one general RSS feed for Turbo pages, they are displayed without problems and Yandex accepted them with great pleasure. The problem is that when trying to generate a separate Turbo page for each article, the application issues: Method Illuminate\View\View::header does not exist .
Do not prompt with what it can be connected?
Controller:

public function article($slug) {
    $article = Article::where('slug', $slug)->where('published', 1)->firstOrFail();

    return view('template.layouts.single-turbo', [
        'articles' => $article
    ])->header('Content-Type', 'text/xml');
}

Route:
Route::get('/blog/{slug?}/turbo', '[email protected]')->name('article');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Ernest Faizullin, 2019-06-22
@fullstackru

// ...
return response()->view(/*...*/)->header('Content-Type', 'text/xml')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question