Created
October 18, 2016 13:52
-
-
Save raank/eaea9f7ec7d13fb0aa460680af1f29c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Http\Middleware; | |
| use Closure; | |
| use Illuminate\Support\Facades\Auth; | |
| class RedirectIfAuthenticated | |
| { | |
| /** | |
| * Handle an incoming request. | |
| * | |
| * @param \Illuminate\Http\Request $request | |
| * @param \Closure $next | |
| * @param string|null $guard | |
| * @return mixed | |
| */ | |
| public function handle($request, Closure $next, $guard = null) | |
| { | |
| if (Auth::guard($guard)->check()) { | |
| if(Auth::user()->permission == 'anunciante') { | |
| return redirect('anunciante/home'); | |
| } else { | |
| return redirect('user/home'); | |
| } | |
| } | |
| return $next($request); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment