jeudi 11 février 2016

How to insert a code in a blade view dynamically

Using laravel 5.1, could I insert a custom code into a blade view dynamically? For example, I have this view.blade.php :

<html>
<head>
    <title>App Name - @yield('title')</title>
</head>
<body>
    @section('sidebar')
        This is the master sidebar.
    @show

    <div class="container">
        @yield('content')
        // Here, I want to insert a code dynamically, for example :
        <div> <p> something </p> </div>
    </div>
</body>

So, Is there a good way to do something like this in controller :

$customCode = "<div> <p> something </p> </div>";
$content = (string) $view;
//For example I want to insert this code into line 11 of view file
updateContent($content, $customCode, $line_position_in_view);    



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire