未找到NeoEloquent类Symfony \ Component \ Debug \ Exception \ FatalThrowableError

时间:2018-02-19 17:24:18

标签: php laravel-5 neo4j neoeloquent

我尝试使用NeoEloquent在两个对象之间创建链接。不幸的是我收到了以下错误。

Class 'Permission' not found

NeoEloquent Error

我尝试了很多东西但不幸的是我无法让它工作。

我将要链接的权限对象提交为表示标签ID的整数。

标签之间的关系是多对多关系。据我所知,我已经做好了一切。我已经在GitHub页面上查看了,这对我来说很好。

提前致谢!

控制器方法:

/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  Role  $role
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Role $role)
    {
        //dd($request);
        $this->validate($request, [
            'title' => 'required',
        ]);

        foreach($request['permission'] as $perm){
            $role->permissions()->attach($perm);
        }

        $role->title = request('title');

        $role->save();

        return redirect("/roles");
    }

角色模型:

<?php

namespace App;


use Vinelab\NeoEloquent\Eloquent\Model as NeoEloquent;



class Role extends NeoEloquent
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'title',
    ];

    protected $label = "Role";

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [

    ];

    public function permissions(){
        return $this->hasMany('Permission', 'Has_Permission');
    }
}

许可模式:

<?php

namespace App;


use Vinelab\NeoEloquent\Eloquent\Model as NeoEloquent;


class Permission extends NeoEloquent
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'title',
    ];

    protected $label = "Permission";

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
    ];

}

0 个答案:

没有答案