我刚刚为laravel下载了名为laravelista/comments的搜索类
文档非常少,所以我不太了解所有内容。
基本上,当我尝试在localhost:8000 / login中输入我的详细信息并按submit
后尝试执行操作时,它会将我定向到laravel PrettyPageHandler并显示此错误:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Trait 'Laravelista\Comments\Comments\Traits\Comments' not found
我已经下载了laravelista / comments并运行所有命令,例如:
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中:
<?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',
];
}
请帮助。
答案 0 :(得分:0)
我只需要将User.php更改为
<?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