Blade conditional extends

元气小坏坏 提交于 2019-12-11 02:12:34

问题


I know this seems like an answered question, but it is not (I hope).

What I looking for is a way to extends or NOT a view: if the request is an ajax call the view does not extends nothing. Something like:

@if(!Request::ajax())

    @extends('navbar')

       @section('home')
          <div>"my content"</div>
       @stop

@else

    <div>"my content"</div>

@endif

This is NOT what I looking for:

@extends((( Request::ajax()) ? 'layouts.ajax' : 'layouts.default' ))

I mean if the request is an ajax call, I want the view do not extend nothing.

Hope to be clear.

Thx!


回答1:


Solved using the @include statement



来源:https://stackoverflow.com/questions/31172530/blade-conditional-extends

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!