Fewos in CRM,
Fewo Clients Bookings create / edit / delelte via API in DB
This commit is contained in:
parent
aebfb0586a
commit
c0c2a1822c
55 changed files with 9787 additions and 1486 deletions
110
app/Models/TravelUser.php
Normal file
110
app/Models/TravelUser.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
* Date: Thu, 21 Mar 2019 13:39:44 +0100.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TravelUser
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $salutation_id
|
||||
* @property string $title
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property string $company
|
||||
* @property string $street
|
||||
* @property string $zipcode
|
||||
* @property string $city
|
||||
* @property string $phone
|
||||
* @property string $mobil
|
||||
* @property string $fax
|
||||
* @property \Carbon\Carbon $birthday
|
||||
* @property int $travel_nationality_id
|
||||
* @property string $last_user_data
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $deleted_at
|
||||
* @property \App\Models\TravelNationality $travel_nationality
|
||||
* @property \Illuminate\Database\Eloquent\Collection $travel_user_booking_fewos
|
||||
* @package App\Models
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUser onlyTrashed()
|
||||
* @method static bool|null restore()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUser withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\TravelUser withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TravelUser extends Model
|
||||
{
|
||||
use \Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'travel_users';
|
||||
|
||||
protected $casts = [
|
||||
'salutation_id' => 'int',
|
||||
'travel_nationality_id' => 'int',
|
||||
'last_user_data' => 'array'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'birthday'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'salutation_id',
|
||||
'title',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'email',
|
||||
'password',
|
||||
'company',
|
||||
'street',
|
||||
'zipcode',
|
||||
'city',
|
||||
'phone',
|
||||
'mobil',
|
||||
'fax',
|
||||
'birthday',
|
||||
'travel_nationality_id',
|
||||
'last_user_data'
|
||||
];
|
||||
|
||||
public function travel_nationality()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\TravelNationality::class);
|
||||
}
|
||||
|
||||
public function travel_user_booking_fewos()
|
||||
{
|
||||
return $this->hasMany(\App\Models\TravelUserBookingFewo::class);
|
||||
}
|
||||
|
||||
|
||||
public function getBirthdayAttribute($value)
|
||||
{
|
||||
if(!$value){
|
||||
return "";
|
||||
}
|
||||
return Carbon::parse($value)->format(Util::formatDateDB());
|
||||
}
|
||||
|
||||
public function setBirthdayAttribute( $value ) {
|
||||
$this->attributes['birthday'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue