/** * Vendor login * *@return redirect */ function postLogin() { $rules = array('email' => 'required|email', 'password' => 'required|min:2'); $email = Input::get('email'); $password = Input::get('password'); $validator = Validator::make(['email' => $email, 'password' => $password], $rules); if ($validator->passes()) { $vendorExists = ProfileModel::vendorExists($email, $password); if ($vendorExists) { Session::put('vendor_id', $vendorExists); return Redirect::to('/profile'); } else { return Redirect::to('/')->with('e_msg', 'Login credentials are incorrect.'); } } return Redirect::to('/')->with('e_msg', 'Something went wrong with the login!')->withErrors($validator)->withInput(); }