使用Entrust时如何修复Laravel BadMethodCallException

时间:2017-02-24 12:12:35

标签: php laravel entrust

始终获得

  [BadMethodCallException]
  This cache store does not support tagging.

当我尝试运行包含save函数的数据库命令时,它会产生此错误,我认为是因为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']),
        ]);
    }
}

注册控制器代码

2 个答案:

答案 0 :(得分:0)

ValueAxis文件中设置CACHE_DRIVER=array

Source

答案 1 :(得分:0)

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

  

角色许可模式和表格与相同的模式

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

  

下一次我编辑了中间件,以便看到我的角色,允许作为   STRINGS

创建模型后

。只需Zizaco\Entrust\Middleware\EntrustRole即可删除爆炸功能。对于其他两个中间件