public function doLogin() { $email = Input::get('email'); $password = Input::get('password'); $agent = AgentModel::whereRaw('email = ? and secure_key = md5(concat(salt, ?))', array($email, $password))->get(); if (count($agent) != 0) { Session::set('agent_id', $agent[0]->id); $agent[0]->is_active = false; $agent[0]->save(); return Redirect::route('agent.process'); } else { $alert['msg'] = 'Invalid Email and Password'; $alert['type'] = 'danger'; return Redirect::route('agent.auth.login')->with('alert', $alert); } }