dqqpf32897 2016-08-25 12:54
浏览 67

在laravel中登录后显示登录信息

Hi i am using laravel to login any user I have created my own user table and the code is as follows:

function login(Request $request) {
        $this->middleware('auth');
        $rules = array(
            'user_login' => 'Required',
            'user_login_password' => 'Required'
        );
        $validator = Validator::make($request->all(), $rules);
        if (!$validator->fails()) {
            if (Auth::attempt(['email' => base64_decode(base64_decode(trim($request->input('user_login')))), 'password' => base64_decode(base64_decode($request->input('user_login_password')))])) {
                die('1');
            } else {
                echo 'Incorrect email or password.';
                die;
            }
        } else {
            echo implode('<br/>', $validator->errors()->all());
            die;
        }
    }

Now I am showing the data in next page after login by Auth::user()->email. But is just showing the error as follows: So please help me to fix out the problem,

ErrorException in 0e5a47fe67787924c88247a752bd05e24b49d01c.php line 51: Trying to get property of non-object (View: /var/www/html/recore_web/resources/views/templates/administrator/header.blade.php) (View: /var/www/html/recore_web/resources/views/templates/administrator/header.blade.php) (View: /var/www/html/recore_web/resources/views/templates/administrator/header.blade.php)

This is my header.blade.php code..

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
    <title><?php echo isset($title) ? $title : (($this->router->method === 'index') ? '' : ucwords(str_replace('_', ' ', $this->router->method))) . ' ' . ucwords(str_replace('_', ' ', $this->router->class)); ?></title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <link href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" />
        <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic" rel="stylesheet" type="text/css">
        <link href="<?php echo url('/'); ?>assets/css/base.css" rel="stylesheet" type="text/css" />
        <link href="<?php echo url('/'); ?>assets/css/skins/_all-skins.css" rel="stylesheet" type="text/css" />
        <link href="<?php echo url('/'); ?>assets/css/custom.css" rel="stylesheet" type="text/css" />
        <script src="//code.jquery.com/jquery.min.js"></script>
        <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" type="text/javascript"></script>
        <!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
            <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
        <script type="text/javascript">var base_url = '<?php echo url('/'); ?>';</script>
    </head>
  • 写回答

2条回答 默认 最新

  • duanbohan2015 2016-08-25 13:06
    关注

    Please check your layout folder in that header.blade.php

    You can find that code by just open "0e5a47fe67787924c88247a752bd05e24b49d01c.php" and look for line num 51.

    If you use sublime text editor just Ctrl + P type file name "0e5a47fe67787924c88247a752bd05e24b49d01c.php and check line num 51.

    In administrator/header.blade.php try to fetch data but object is not passed/created.

    You can post your header.blade.php so I can guide you more.

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?