Koen Hoeijmakers is a back-end developer with serious experience in laravel based systems.
koenhoeijmakers / laravel-translatable Goto Github PK
View Code? Open in Web Editor NEWA fresh new way to handle model translations.
License: MIT License
A fresh new way to handle model translations.
License: MIT License
At the moment there is no fallback locale for when a translation is missing, the default is to return null
.
But it might be nice to optionally be able to load the default
locale.
Declaration of KoenHoeijmakers\LaravelTranslatable\HasTranslations::resolveRouteBinding($value) must be compatible with Illuminate\Database\Eloquent\Model::resolveRouteBinding($value, $field = NULL)
I'm not sure if this can be updated without breaking backwards compatibility
At the moment you can't query like this, because applyScopes()
is called only just before get()
and thus overrides the select
.
Model::query()->addSelect('something')->get();
I suppose making select
into addSelect
in the JoinTranslationScope
fixes the issue.
$language = Language::updateOrCreate([
'id' => $values[1],`
'name' => $values[2],`
'parent_id' => $values[3],
]);
cause the following error:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous (SQL: select 'languages'.*, 'language_translations'.'name' from 'languages' left join 'language_translations' on 'languages'.'id' = 'language_translations'.'language_id' and 'locale' = nl where ('id' = 1 and 'parent_id' = 0) limit 1)
If there is no easy fix for this, is there an other way to use updateOrCreate
?
Update: even simple things like Language::whereId(1)->get();
cause the same issue
We can't guarantee that changes won't break current applications unless we add unit tests.
$animal->storeTranslation([
'nl' => [
'name' => 'Aap',
],
'de' => [
'name' => 'Affe',
],
]);
Sould change to
$animal->storeTranslations([
'nl' => [
'name' => 'Aap',
],
'de' => [
'name' => 'Affe',
],
]);
that is storeTranslations with an s at the end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.