Code Monkey home page Code Monkey logo

moonshine-spatie-translatable's Introduction

moonshine-spatie-translatable's People

Contributors

alexvenga avatar ge1i0n avatar sweet1s avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sweet1s

moonshine-spatie-translatable's Issues

Некорректно сохраняет поле

Всем привет, сталкнулся такой проблемой при работе с этим пакетом, что при сохранении поля value из связующей таблицы, поле value пытается сохранить в таблицу tariffs, а если в ресурсе заменить поле Translatable на Text то все работает корректно.

Таблицы tariffs, tariff_plans, tariff_tariff_plan
В tariff_tariff_plan есть дополнительное поле value
composer.json: "visual-ideas/moonshine-spatie-translatable": "^2.1"

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'value' in 'field list'

update `tariffs` set `value` = {"en":"30$"}, `tariffs`.`updated_at` = 2024-06-06 12:06:39 where `id` = 1
class Tariff extends Model
{
    use HasFactory, HasTranslations;

    public array $translatable = ['label', 'pivot.value'];

    protected $fillable = [
        'active',
        'label',
        'sort',
    ];

    protected $casts = [
        'active' => 'boolean',
        'label' => 'json',
        'sort' => 'integer',
    ];

    public function tariffPlans(): belongsToMany
    {
        return $this->belongsToMany(TariffPlan::class)
            ->withPivot(['tariff_type', 'value', 'sort'])
            ->orderByPivot('sort');
    }
}
class TariffPlan extends Model
{
    use HasFactory, HasTranslations;

    public array $translatable = ['label', 'price', 'pivot.value'];

    protected $fillable = [
        'label',
        'price',
        'active',
        'sort',
    ];

    protected $casts = [
        'label' => 'json',
        'price' => 'json',
        'active' => 'boolean',
        'sort' => 'integer',
    ];

    public function tariffs(): belongsToMany
    {
        return  $this->belongsToMany(Tariff::class)
            ->withPivot(['tariff_type', 'value', 'sort'])
            ->orderByPivot('sort');
    }
}
class TariffTariffPlan extends Model
{
    use HasFactory, HasTranslations;

    public array $translatable = ['value'];

    protected $fillable = [
        'tariff_id',
        'tariff_plan_id',
        'tariff_type',
        'value',
        'sort',
    ];

    protected $casts = [
        'tariff_id' => 'integer',
        'tariff_plan_id' => 'integer',
        'tariff_type' => 'string',
        'value' => 'json',
        'sort' => 'integer',
    ];

    public function tariff(): belongsTo
    {
        return $this->belongsTo(Tariff::class);
    }

    public function plan(): belongsTo
    {
        return $this->belongsTo(TariffPlan::class);
    }
}

TinyMce и другие WYSIWYG редакторы

Заметил что у вас в пакете закомментирован метод tinyMce. Есть определенная причина? Ну и в целом желательно добавить возможность использовать и другие редакторы.

Translatable->removable is not working!

Tabs::make([ Tab::make('Main', [ ID::make()->sortable(), Translatable::make('name') ->languages(config('app.available_languages')) ->removable(), Translatable::make('description') ->hideOnIndex() ->languages(config('app.available_languages')) ->removable(), ]), Tab::make('Gallery', [ MediaLibrary::make('Galerry', 'tour_images') ->multiple() ->removable() ]) ])

I cant remove created fields with different languages. I delete them and then I press save and everythin gets back!!

Translatable - предложения

Добрый день, на текущий момент нашел следующие баги:
Предположим есть ресурс:
image

  1. При редактировании не сохраняется/передается ключ, как следствие данные не отображаются.
    image

  2. При создании dropdown улетает под слой
    image

  3. Текущий массив со списком языков имеет protected свойство и в списке всегда отображается "полотно" языков (они же ключи) что не совсем удобно. priorityLanguages немного не то. Есть ли вариант вынести например в конфигурацию, массив языков по умолчанию, если такой не определён предоставить все языки.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.