Set Master Layout Head Tag from Controller

Submitted by doguhan - 9 years ago

İşin Türkçesi şu: Controller dan Master içine değer aktarılarak tüm view ler için özelleştirilebilir head meta tag yada diğer değişmesini istediğimiz dinamik alanların oluşturulması..

//controller
public function index()
    {
 
        $this->layout = view('hello'); // get hello view 
        $this->layout->title = 'Başlık'; // hello view set title tag
        return $this->layout; // return hello view
     
    }
/*-----------------------------------------------------------*/
    //hello.blade.php
    @extends('master')
    @section('content')
        ssss
    @stop
/*-------------------------------------------------------*/    
    //master.blade.php
<html>
    <head>
        <title>{!! $title !!}</title>  //L5 title value
    </head>
    <body>
 
    @yield('content')
    </body>
</html>