Exemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (strtolower(Auth::staff()->get()->role->id) != 1 and strtolower(Auth::staff()->get()->role->id) != 2) {
         abort('404');
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::user()->get()) {
         return redirect()->route('welcome');
     } elseif (Auth::staff()->get()) {
         return redirect()->route('staff_login');
     }
     return $next($request);
 }
 public function postStaffLogin(Request $request)
 {
     $this->validate($request, ['email' => 'required', 'password' => 'required']);
     $credentials = $request->only('email', 'password');
     //		dd($credentials);
     if (Auth::staff()->attempt($credentials, $request->has('remember'))) {
         return redirect()->route('admin');
     }
     return redirect()->route('staff_login')->withInput($request->only('email', 'remember'))->withErrors(['email' => $this->getFailedLoginMessage()]);
 }
Exemplo n.º 4
0
 /**
  * Create a new filter instance.
  *
  * @param  Guard  $auth
  * @return void
  */
 public function __construct()
 {
     $this->auth = Auth::staff();
 }