Exclude a view from master layout?

故事扮演 提交于 2019-11-28 11:55:20

问题


I have login.blade.php in views/users/ that I would like to exclude from the master layout that I have.

Instead I want the login page to be a standalone page with just the login form on it.

How may I achieve that?


回答1:


Use a different layout for login page:

File app/views/login.blade.php:

@extends('layouts.standalone')

@section('content')
   ...
@stop

And for your other pages:

File app/views/home.blade.php:

@extends('layouts.master')

@section('content')
   ...
@stop

And here your layouts:

File app/views/layouts/standalone.blade.php:

<html>
   <body>
      This is a master layout

      @yield('content')
   </body> 
</html>

File app/views/layouts/master.blade.php:

<html>
   <body>
      This is a standalone layout

      @yield('content')
   </body> 
</html>


来源:https://stackoverflow.com/questions/22987271/exclude-a-view-from-master-layout

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