dr.calix
dr.calix

Reputation: 727

Access Route params in constructor - Laravel 5.1

I have this code below from my old Laravel 4.x. How can I convert this into Laravel 5.1? I am wondering how can I access the route params in the constructor(or in a middleware) if I convert it to Laravel 5.1

thanks!

public function __construct()
{
    $this->beforeFilter(function($route, $request)
    {
      $this->user     = Auth::user();
      $this->project  = $this->user->getProject( $route->parameter('projects') );
      $this->group    = $this->project->groups()->find( $route->parameter('groups') );
    });
}

Upvotes: 0

Views: 160

Answers (1)

dr.calix
dr.calix

Reputation: 727

I hope someone will be helped by this:

$request->route('companies')

Upvotes: 1

Related Questions