2016-11-03 15 views
3

私は何かを本当に簡単にしようとしています。 私は2ページあります。 admin.blade.phpとleft.blade.php 私はマスターページとして管理ページを使用しようとしています。 left.blade.phpから日付を含むLaravelレイアウトが機能しない

adminページは結果として「test」のみを出力し、left.admin.phpのものは含まれません。 何が間違っているのか分かりません。事前のおかげで

ファイルの構造は、web.phpで

-- resources 
    --views 
    *admin.blade.php 
    *left.blade.php 

<!DOCTYPE html> 
<!-- 
To change this license header, choose License Headers in Project Properties. 
To change this template file, choose Tools | Templates 
and open the template in the editor. 
--> 
<html> 
    <head> 
     <meta charset="UTF-8"> 
    <title> @yield('title')</title> 
</head> 
<body> 
    <?php 
    // put your code here 
    ?> 

    @yield('content') 

    test 
<div id='footer'> 
    @yield('footer') 
</div> 
</body> 
</html> 

admin.blade.php

@extends('admin') 

@section('content') 
    baran 
@stop 

left.blade.php routeコマンドが

です
Route::get('/admin', function() { 
    return view('admin'); 
}); 

答えて

3

あなたはleft.blade.phpから日付を含めたい場合は、admin.blade.php@include()ディレクティブを使用する必要がありますあなたのルートを変更するだけで、あなたの主な内容はleft.blade.phpであり、あなたがレイアウトとしてadmin.blade.phpを使用している場合

@include('left') 

を:

Route::get('/admin', function() { 
    return view('left'); 
}); 
1

内側のページがマスターページを拡張しているため、内側のページのビューを呼び出すとします。

return view('left'); 
+0

私はそれを後方に持ってきました。 – rematnarab

関連する問題