2017-02-10 08:55 阅读 53


I'm having problems with Laravel since i removed Entrust.

Everything was working fine until i tried installing Entrust. I removed it because it kept saying the following message the same as this question Laravel cache store does not support tagging

Laravel cache store does not support tagging

I removed everything to do with Entrust and removed any changes I had to make but since then whenever I try to go to another page after logging in, it redirects back to the login page. I log back in and it redirects to the dashboard as it should but as soon as i go to another page, it redirects me back to login again.

Any ideas how to fix this?


I think i've narrowed down to the problem.

I created a new project and started again. I created the Auth, created a couple test controllers and views.

I logged in as normal and I got redirected to the Home contoller. I then went to another page and it loaded fine as it should. The views are using the default layout in views/layouts/app.blade.php. As soon as I change it to a custom layout the problem occurs again but is okay if i change it back to app.blade.php

Here is my new default.blade.php but i don't see why this doesn't work anymore

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <link rel="icon" type="image/png" href="public/css/favicon-32x32.png" sizes="32x32">
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="//">
    {{ HTML::style('css/bootstrap.css') }}
    @if (!empty($styles))
    @foreach($styles as $style)
    {{ HTML::style($style . '.css') }}
    {{ HTML::style('css/app.css') }}
    {{ HTML::style('css/media.css') }}
<body class="{{ $body_class or '' }}">
<div class="wrapper">
    <div class="push"></div>
<div class="footer navbar-primary">
    <div class="row">
        <div class="col-xs-12">
                <p>&copy; Copyright @php echo date('Y'); @endphp Axminster Tools &amp; Machinery</p>
    window.website_url = '{{ URL::to('/') }}';
{{ HTML::script('assets/src/jquery/dist/jquery.min.js') }}
{{ HTML::script('assets/src/jquery-ui/jquery-ui.min.js') }}
{{ HTML::script('js/bootstrap.min.js') }}
{{ HTML::script('js/validate.js') }}

    @foreach($jsVars as $key => $val)
    var {{ $key }} = {{ $val }};
    $(function() {
        $("#searchform").submit(function(e) {
            $("#searchform").attr("action", "/search/term/" + encodeURI($("#keywords").val()));
@if (!empty($scripts))
@foreach($scripts as $script)
{{ HTML::script($script . '.js') }}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    duanlie7962 duanlie7962 2017-02-13 09:28

    I eventually found the problem.

    After doing a new installation i tested the Auth and it worked. As soon as I copied across some of my template files I found the problem occurred again. After looking at the template layout files, I found I was using this for the logout link

    <a href="{{ Auth::logout() }}">Change password</a>

    I did this within the first few days of learning Laravel and it was never a problem before...don't know why.

    I changed it to this and it all works as expected

    <a href="{{ url('/logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">Logout</a>
    <form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
          {{ csrf_field() }}
    点赞 评论 复制链接分享