微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我的翻译覆盖了所有值 - voyager 1.4.0

如何解决我的翻译覆盖了所有值 - voyager 1.4.0

我使用的是 Laravel 7 和 voyager 1.4.0

    'multilingual' => [
    /*
     * Set whether or not the multilingual is supported by the BREAD input.
     */
    'enabled' => true,/*
     * Select default language
     */
    'default' => 'pl',/*
     * Select languages that are supported.
     */
    'locales' => [
        'pl','en'
      
    ],],

页面模型

<?PHP

namespace App;

use Illuminate\Database\Eloquent\Model;


class Page extends Model
{


    public static function findBySlug($slug){

        return static::where('status','ACTIVE')->where('slug',$slug)->firstOrFail();

    }

}

发布模型

<?PHP

namespace App;

use App\Category;
use Illuminate\Database\Eloquent\Model;
use TCG\Voyager\Traits\Translatable;

class Post extends Model
{

    use Translatable;
    protected $translatable = ['title','body','excerpt','Meta_description','Meta_keywords','SEO_title','slug'];

    protected $fillable = [
        'category_id','user_id',"title",'content','slug','featured_image','is_featured','is_published'
    ];

    

    public function tags(){

         return $this->belongsToMany('App\Tag','tag_post');

    }

    public function category(){

        return $this->belongsTo('App\Category');

    }
    public function user(){

        return $this->belongsTo('App\User');

    }

    public function getRouteKeyName(){
        return 'slug';
    }
}

当我尝试在帖子中更改翻译值时。更改的值正在覆盖表中的所有值

尝试清除缓存/查看

一些图片https://imgur.com/a/3ajdgQt

第二个问题:在页面我有一个语言选择器,但我没有在页面模型中使用可翻译。和任何地方。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。