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>