如何使用laravel登录用户打印会话ID

时间:2016-01-04 14:22:41

标签: laravel

我是Laravel的初学者我想在登录用户后尝试打印login_id会话 如何在登录用户后打印与用户名相关的login_id

将login_id传递到最后一页

这是我的控制器:

$username = Input::get('username');
$password = Input::get('password');
$rules = array('username' => 'required', 'password' => 'required');
$messages = array('username.required' => 'Username is required', 'password.required' => 'Password is required');
$validate = Validator::make($input, $rules, $messages);
Session::put('username', Input::get('username'));
Session::get('username');
if (Session::has('username')) {
    $data = Session::get('username');
    //$user_data = DB::logincheck();
    //Session::put('login_id', $user_data->login_id);
}
if ($validate->passes()) {
    $result = DB::table('registration')->where('username', '=', $username)->where('password', '=', $password)->get();
    //$result=DB::table('student')->where('id','2')->where('name',"like",'d%')->get();
    //$res=DB::table('registration')->lastInsertid('reg_id');
    if ($result) {
        $reg_id = Input::get('id');
        $result1 = DB::table('registration')->find('id', $reg_id)->where('data', $username)->get();
        var_dump($result1);
    }
}

0 个答案:

没有答案