1

总是得到

  [BadMethodCallException]
  This cache store does not support tagging.

当我尝试运行包含保存功能的数据库命令时,它会产生此错误,我认为是因为 Entrust。

在 RegisterController 它显示相同的错误

  [BadMethodCallException]
  This cache store does not support tagging.

但它仍然注册用户。都一样,但代码的任何其他部分都停止了。我该如何解决这个错误。

<?php

namespace App\Http\Controllers\Auth;

use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;

class RegisterController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

    use RegistersUsers;

    /**
     * Where to redirect users after registration.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|min:6|confirmed',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }
}

注册控制器代码

4

2 回答 2

0

CACHE_DRIVER=array在你的.env文件中设置。

来源

于 2017-02-24T15:39:20.020 回答
0

为了纠正这个问题,我完全退出了 Entrust 包并创建了一个新的

具有相同模式的角色权限模型和表

作为委托运行数据库迁移并使用修补程序填充数据。

接下来我编辑了 ENTRUST 的中间件,将我的角色、权限视为字符串

after you create your model. Just to Zizaco\Entrust\Middleware\EntrustRole and just remove the explode function. to this for the other two middlewares

于 2017-02-27T19:21:05.723 回答