Support the ongoing development of Laravel.io →
Requests Views

Hi guys,

I have a strange problem. Due to new packages installation, I had to do a "composer update" on my Laravel 5.0.5 app. I followed the official documentation and I did the unique mentioned change (http://laravel.com/docs/5.0/upgrade#upgrade-5.0.16). Now my custom middleware doesn't work. This is the code:

<?php namespace Presenze\Http\Middleware;

use Closure;
use Presenze\Company;

class LayoutData {

protected $company;

public function __construct(Company $company)
{
    $this->company = $company;
}

public function handle($request, Closure $next)
{
	$response = $next($request);
	if (gettype($response) === "object")
	{
	    return $response->with('userCompanies', $this->company->getUserCompanies());
	}
	return $response;
}

   }

before the update the middleware was working fine. Now it doesn't alter the response object adding the $userCompanies object.

Any idea?

Last updated 3 years ago.
0

I found something. Now the with() method doesn't work with $response object... why?

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

salgua salgua Joined 16 Oct 2014

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.

© 2025 Laravel.io - All rights reserved.