public function store(LoginRequest $request) { $userEmail = User::where('email', Input::get('email'))->first(); if (!$userEmail) { $empresaEmail = Empresa::where('email', Input::get('email'))->first(); if (!$empresaEmail) { Session::flash('message-error', 'El email ingresado no se encuentra registrado.'); return Redirect::back(); //->withInput()->withFlashMessage('Unknown username.'); } else { if (Auth::empresa()->attempt(['email' => Input::get('email'), 'password' => Input::get('password')])) { return Redirect::to('/empresas'); } Session::flash('message-error', 'Datos son incorrectos'); return Redirect::to('/Login'); } } else { if (Auth::user()->attempt(['email' => Input::get('email'), 'password' => Input::get('password')])) { return Redirect::to('/usuarios'); } } Session::flash('message-error', 'Datos son incorrectos'); return Redirect::to('/login'); }
public function store(EmpresaCreateRequest $request) { Empresa::create($request->all()); Session::flash('message', 'Empresa creada correctamente'); return Redirect::to('/empresas'); }