Saturday, March 18, 2017

How to render multiple blade view sections using controller

When request is ajax, i am rendering content section and inserting it to DOM. It is working as expected.

However.. i can't find out the way, how to render multiple sections, like content and title in the same time.

Controller:

public function index(Request $request) {
   if($request->ajax()){
       return view('awesome')->renderSections()['content'];
   }
   return view('awesome');
}

Blade:

@extends('layouts.app')
@section('title', 'Awesome')
@section('content')
<span>Awesome</span>
@endsection

Question:

How to render both or more of them in same time? Should i use an array?

Sorry for bad english, and thanks for any answers.



via Tauras

Advertisement