FleetCart/Modules/Support/Eloquent/TranslationModel.php
2023-06-11 13:14:03 +01:00

28 lines
595 B
PHP

<?php
namespace Modules\Support\Eloquent;
use Illuminate\Database\Eloquent\Model;
abstract class TranslationModel extends Model
{
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
/**
* Perform any actions required before the model boots.
*
* @return void
*/
public static function booting()
{
static::addGlobalScope('locale', function ($query) {
$query->whereIn('locale', [locale(), config('app.fallback_locale')]);
});
}
}