定制 we-are-neopix/laravel-model-translation 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

we-are-neopix/laravel-model-translation

Composer 安装命令:

composer require we-are-neopix/laravel-model-translation

包简介

This package is a driver based solution to translating Laravel models. It contains two drivers for storing translations in the database and in a JSON file, but also contains a plug-and-play system for its users to implement custom drivers for storing translations and use them with the package.

README 文档

README

Latest Stable Version Software License Build Status Scrutinizer Code Quality

For Laravel 7 and 8 use version ~1.2

This package is meant to simplify the process of making Eloquent models translatable. It's aim is to deviate as little as possible from Laravel's Eloquent API but still provide a satisfiable level of flexibility. This is achieved by utilizing a driver-based approach to storing translations and a trait which allows Model instances to seamlessly interact with the translation storage.

After setting the package up, all that takes to use your models with translations is this:

$post = BlogPost::find(1); // An instance of the BlogPost model

App::setLocale('sr');
$post->title = 'Naslov na srpskom';
$post->save();

$post->setLanguage('en');
$post->title = 'Title in English';
$post->save();

$post->title; // Returns 'Title in English';
$post->setLanguage('sr')->title; // Returns 'Naslov na srpskom'

Since this is a driver-based solution, you have the full power to implement the architecture for persistently storing translations yourself. Of course, the package comes with two drivers out of the box, JSON and MySQL, but you are free to implement your own drivers and rely on whatever architecture you prefer.

For a more detailed explanation on how the package works and how to use it, please visit our wiki pages.

统计信息

  • 总下载量: 410
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 40
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 40
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固