codigo actual del servidor, con avances de joan

This commit is contained in:
Jose Sanchez
2023-08-07 15:52:04 -04:00
commit 3cd9b8bbe8
3070 changed files with 532255 additions and 0 deletions

29
app/Models/City.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class City extends Model
{
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$city_translation = $this->hasMany(CityTranslation::class)->where('lang', $lang)->first();
return $city_translation != null ? $city_translation->$field : $this->$field;
}
public function city_translations(){
return $this->hasMany(CityTranslation::class);
}
public function country()
{
return $this->belongsTo(Country::class);
}
public function state()
{
return $this->belongsTo(State::class);
}
}