Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set casts/data types to multilingual attributes in Eloquent Model #10476

Open
Vitaliy-1 opened this issue Sep 26, 2024 · 1 comment
Assignees
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days.
Milestone

Comments

@Vitaliy-1
Copy link
Collaborator

Describe the bug
As part of #10328 multilingual attributes are introduced. For now, it's impossible to set a specific cast for the as per Laravel documentation:

    protected function casts(): array
    {
        return [
            'title' => 'string',
            'description' => 'string',
        ];
    }

because multilingual values actually are arrays

Apart of that, consider also if ability to directly add multilingual value in the default locale is beneficial, e.g.:

Announcement::create([
    "assocType" => "256",
    "assocId" => "1",
    "typeId" => null,
    "title" => "Test Announcement 201",
    "description" => "<p>Test Announcement 201</p>",
    "descriptionShort" => "<p>Test Announcement 201</p>",
    "someData" => "my new data"
]);

see: #10382 (comment)

@Vitaliy-1 Vitaliy-1 added this to the 3.5.0 LTS milestone Sep 26, 2024
@Vitaliy-1 Vitaliy-1 added the Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days. label Sep 26, 2024
@Vitaliy-1 Vitaliy-1 modified the milestones: 3.5.0 LTS, 3.5 Internal Sep 26, 2024
@touhidurabir touhidurabir self-assigned this Oct 22, 2024
touhidurabir added a commit to touhidurabir/pkp-lib that referenced this issue Oct 22, 2024
touhidurabir added a commit to touhidurabir/pkp-lib that referenced this issue Oct 22, 2024
@touhidurabir
Copy link
Member

@Vitaliy-1 please check the commit bed3f45 .

I initially planned to make this a separate PR but as few fix needed related to handle the update and guarded attributes, I have made the fix of this a part of #10292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days.
Projects
None yet
Development

No branches or pull requests

3 participants