-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Middleware; redirect instead of throw exception #21
Comments
Actually i think it's a good idea. |
I tried it with: // config
'middleware_handling' => 'abort',
'middleware_params' => '403',
// middleware
if ($this->auth->guest() || !$request->user()->ability($roles, $permissions, [ 'validate_all' => $validateAll ]))
{
return call_user_func(Config::get('laratrust.middleware_handling'), Config::get('laratrust.middleware_params'));
} ... it works, but there are some errors in the tests:
But I did not figure out how to resolve it yet. Any idea? |
@Naoray Indeed i'm working on it. I think the problem is the test. |
Could you please try it out, i got it working in 556515a. remember to add the |
you've had a typo in the middlewares... fixed it in #24 . It works perfectly, but the tests are still failing!! :/ |
@Naoray yeah i had the typo, maybe i did the typo in the tests too, i'm going to check it out |
@Naoray Yeah the problem was that the typo was on the tests too. i'm solving it now. Thank you! 👍 |
@santigarcor got them! fixed in #25 |
Wouldn't it be nicer if we would use a redirect to a specifiable route instead of just calling
abort(403)
. Or maybe make it optional?!We could ad a config entry like
and change
abort(403)
in Middleware tocall_user_func(config('laratrust.midleware_handling'), config('middleware_params));
=> just an idea!
The text was updated successfully, but these errors were encountered: