返回所有翻译成英语的帖子 Post::translatedIn('en')->get();
返回所有未翻译成英语的帖子 Post::notTranslatedIn('en')->get();
返回未在任何区域设置中翻译的所有文 Post::translated()->get();
Eager只为默认和回退(如果启用)区域设置加载转换关系 返回当前语言下的文章 Post::withTranslation()->get();
返回一个数组,其中包含一对post id和翻译后的title属性 Post::listsTranslations('title')->get()->toArray();
返回一个数组,其中包含一对post id和翻译后的title属性 Post::listsTranslations('title')->get()->toArray();
通过对照给定值检查翻译来筛选帖子 whereTranslation(string $translationField, $value, ?string $locale = null) Post::whereTranslation('title', 'My first post')->first();
Post::whereTranslation('title', 'My first post') ->orWhereTranslation('title', 'My second post') ->get();
Post::whereTranslationLike('title', '%first%')->first();
Post::whereTranslationLike('title', '%first%') ->orWhereTranslationLike('title', '%second%') ->get();
按给定的转换列值对模型排序 Post::orderByTranslation('title')->get()
// If a german translation doesn't exist, it returns // a new instance of CountryTranslation. $translation = $post->translateOrNew('tu'); 例: if(empty($posts->hasTranslation('tu'))){
$posts->translateOrNew('tu')->title = "tu title";
$posts->translateOrNew('tu')->content = "tu content";
$posts->save();
}
return $translation = $posts->getNewTranslation('tu');
$posts->translations();
$posts->deleteTranslations();
$posts->deleteTranslations('zh');
$clones_posts = $posts->replicateWithTranslations();
#translationWith
return Column::where('mid',102)->translationWith(['children'=>function($q){ return $q->where('status','1'); }])->get();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。