芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/store.kwesioben.com/app/Model/DealOfTheDay.php
'float', 'product_id' => 'integer', 'status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; public function product() { return $this->belongsTo(Product::class); } public function translations() { return $this->morphMany(Translation::class, 'translationable'); } public function getTitleAttribute($title) { if (strpos(url()->current(), '/admin') || strpos(url()->current(), '/seller')) { return $title; } return $this->translations[0]->value??$title; } protected static function boot() { parent::boot(); static::addGlobalScope('translate', function (Builder $builder) { $builder->with(['translations' => function ($query) { if (strpos(url()->current(), '/api')){ return $query->where('locale', App::getLocale()); }else{ return $query->where('locale', Helpers::default_lang()); } }]); }); } }