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

@ -58,6 +58,8 @@ use Illuminate\Support\Str;
* @property array|null $contact_lands
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereContactLands($value)
* @property-read int|null $travel_nationality_requirements_count
* @property array|null $contact_emails
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereContactEmails($value)
*/
class TravelCountry extends Model
{
@ -81,13 +83,14 @@ class TravelCountry extends Model
'contact_text_4',
'contact_footer',
'entry_requirements',
'contact_emails',
'is_customer_country',
'active_frontend',
'active_backend'
];
protected $casts = ['contact_lands' => 'array'];
protected $casts = ['contact_lands' => 'array', 'contact_emails' => 'array'];
public $timestamps = false;
@ -115,6 +118,26 @@ class TravelCountry extends Model
}
}
public function getContactEmailsStr($glue=PHP_EOL){
if(isset($this->contact_emails)){
return implode($glue, $this->contact_emails);
}
return "";
}
public function getContactLandsArray(){
$ret = [];
if($this->contact_lands){
foreach ($this->contact_lands as $contact_land_id){
$travel_country = TravelCountry::where('crm_id', $contact_land_id)->first();
if($travel_country){
$ret[] = $travel_country->name;
}
}
}
return $ret;
}
public function getNationalityRequirement($travel_nationality_id){
$model = TravelNationalityRequirement::where('travel_country_id', $this->id)->where('travel_nationality_id', $travel_nationality_id)->first();