Support the ongoing development of Laravel.io →
Requests Views
Last updated 1 year ago.
0

Change \View::share with $view->with.

Last updated 1 year ago.
0

Tnx Marwelln but that did not do it.

I investigated a bit more. Made a fresh install of Laravell 4.2. The only code I added now is:

// in: filters.php
App::before(function($request)
{
  View::composer('*', function($view) {   
    echo '-> ' . $view->getName() . '<br>';    
  });
});
App::after(function($request, $response)
{
  if($response instanceof Illuminate\Http\Response){        
    $originalContent = $response->getOriginalContent();    
    /** 
     * The line below makes the View::composer() run twice
     */
    $test = (string) $originalContent;  // ( Or $originalContent->render() ) 
  }
});

// and in: bootstrap.compiled.php in class View
public function __construct( .. )
{
    echo "in View::__construct($view)<br>";
    //~

Result:
print screen from browser

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.