Initial commit
This commit is contained in:
31
app/Models/Locations/CountryLocale.php
Normal file
31
app/Models/Locations/CountryLocale.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Locations;
|
||||
|
||||
use App\Models\Scopes\LocalizeScope;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class CountryLocale extends Model
|
||||
{
|
||||
/**
|
||||
* The database table doesn't use 'created_at' and 'updated_at' so we disable it from Inserts/Updates.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
// Scope a query to only include country locales that match the current application locale or fallback locale.
|
||||
static::addGlobalScope(new LocalizeScope);
|
||||
}
|
||||
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class, 'country_id');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user