first upload all files

This commit is contained in:
NW
2023-06-11 13:14:03 +01:00
parent f14dbc52b5
commit c08b36d1b6
1705 changed files with 106852 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace Modules\Support\Eloquent;
use Astrotomic\Translatable\Translatable as AstrotomicTranslatable;
trait Translatable
{
use AstrotomicTranslatable;
/**
* Save the model to the database.
*
* @param array $options
* @return bool
*/
public function save(array $options = [])
{
if (parent::save($options)) {
return $this->saveTranslations();
}
return false;
}
/**
* This scope filters results by checking the translation fields.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $key
* @param array $values
* @param string $locale
* @return \Illuminate\Database\Eloquent\Builder|static
*/
public function scopeWhereTranslationIn($query, $key, array $values, $locale = null)
{
return $query->whereHas('translations', function ($query) use ($key, $values, $locale) {
$query->whereIn($key, $values)
->when(! is_null($locale), function ($query) use ($locale) {
$query->where('locale', $locale);
});
});
}
}