首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到特征'Laravelista\Comments\Comments\Traits\Comments‘

找不到特征'Laravelista\Comments\Comments\Traits\Comments‘
EN

Stack Overflow用户
提问于 2019-04-04 16:05:09
回答 1查看 351关注 0票数 0

我刚刚下载了一个名为laravelista/comments的laravel搜索类

文档非常少,所以我并不是真的理解所有的东西。

基本上,当我在‘’localhost:8000/ submit‘中输入我的详细信息并按下登录后,它会将我引导至laravel PrettyPageHandler,并显示以下错误:

代码语言:javascript
复制
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Trait 'Laravelista\Comments\Comments\Traits\Comments' not found

我已经下载了laravelista/comments并运行了所有命令,如下所示:

代码语言:javascript
复制
php artisan vendor:publish --provider="Laravelista\Comments\Providers\CommentsServiceProvider" --tag=migrations

php artisan migrate


php artisan vendor:publish --provider="Laravelista\Comments\Providers\CommentsServiceProvider" --tag=config

php artisan vendor:publish --provider="Laravelista\Comments\Providers\CommentsServiceProvider" --tag=public --force

但我仍然会遇到这个错误

在我的User.php中:

代码语言:javascript
复制
<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravelista\Comments\Comments\Traits\Comments;


class User extends Authenticatable
{
    use Notifiable;
    use Comments;


    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

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

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}

请帮帮忙。

EN

回答 1

Stack Overflow用户

发布于 2019-04-04 16:20:21

我只需要把User.php改成

代码语言:javascript
复制
<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;


use Laravelista\Comments\Commenter;


class User extends Authenticatable
{
    use Notifiable,Commenter;



    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

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

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}

我用错了use

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55510826

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档