Mail and Booking

This commit is contained in:
Kevin Adametz 2020-04-15 12:11:42 +02:00
parent 62e84637b6
commit 5daea268f7
250 changed files with 5377 additions and 1473 deletions

View file

@ -38,6 +38,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereContactLands($value)
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Booking[] $bookings
* @property-read int|null $bookings_count
* @property array|null $contact_emails
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereContactEmails($value)
*/
class TravelCountry extends Model
{
@ -57,15 +59,14 @@ class TravelCountry extends Model
'contact_text_3',
'contact_text_4',
'contact_footer',
'contact_emails',
];
protected $casts = ['contact_lands' => 'array'];
protected $casts = ['contact_lands' => 'array', 'contact_emails' => 'array'];
public $timestamps = false;
/*public function leads()
{
return $this->hasMany(Lead::class, 'travelcountry_id', 'id');
@ -76,8 +77,17 @@ class TravelCountry extends Model
return $this->hasMany(Booking::class, 'travel_country_id', 'id');
}
public function getCountryLands(){
$ret = [];
if($this->contact_lands){
foreach ($this->contact_lands as $travel_country_id){
if($travel_country = TravelCountry::find($travel_country_id)){
$ret[$travel_country->id] = $travel_country->name;
}
}
}else{
$ret[$this->id] = $this->name;
}
return $ret;
}
}