Note, I'm using Route Model Bindings to a pass an inferred model from the URI to the Controller.
It's worth noting to combat this, I've made sure every model that I utilize returns a "team" object and then have a middleware that attempts to parse the model from the URI and check permissions like so:
public function handle($request, Closure $next)
{
$route = $request->route();
$model = $route->parameters[$route->parameterNames[0]];
if (!(Auth::user()->isTeamAdmin($model->team)) && Auth::user()->currentTeam->is($model->team)) {
Alert::message('Whoops!', 'You don\'t seem to have permission to do that.', 'error', ['toast' => true, 'position' => 'bottom', 'timer' => 3000, 'showConfirmButton' => false]);
return Redirect::back();
}
return $next($request);
}
However this convoluted workaround is hard to maintain and requires me to define a "team" attribute for every route model binding that may get ran through the middleware.