您好,我正在使用 Laravel-activitylog,当我尝试将火车添加到模型时,它给了我这个错误
App\Models\Setting 类包含 1 个抽象方法,因此必须声明为抽象方法或实现其余方法 (App\Models\Setting::getActivitylogOptions)
这是我所有的模型代码
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Astrotomic\Translatable\Translatable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
use Spatie\Activitylog\Traits\LogsActivity;
class Setting extends Model
{
use Translatable,SoftDeletes;
use LogsActivity;
public $translatedAttributes = ['name', 'slogan', 'description', 'summary', 'address'];
protected $fillable = ['id', 'logo', 'favicon', 'phone', 'email', 'facebook', 'twitter', 'instagram', 'created_at', 'updated_at'];
// protected static $logAttributes = ['name', 'logo'];
public static function check()
{
$setting = Self::all();
if(count($setting)<1)
{
$arrayName = array();
$arrayName['id']= 1;
foreach(config("app.languages") as $key => $language)
{
$arrayName[$key]['name'] = $language;
$arrayName[$key]['description'] = $language;
}
Self::create($arrayName);
}
return $setting = Self::where('id','1')->first();
}
}