mivita/app/Models/Account.php
2018-10-29 09:39:31 +01:00

134 lines
6 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\Account
*
* @property int $id
* @property int $user_id
* @property int $company
* @property string|null $company_name
* @property string|null $company_street
* @property string|null $company_postal_code
* @property string|null $company_city
* @property int|null $company_pre_phone_id
* @property string|null $company_phone
* @property string|null $company_homepage
* @property int|null $company_country_id
* @property string|null $salutation
* @property string|null $title
* @property string|null $first_name
* @property string|null $last_name
* @property string|null $street
* @property string|null $postal_code
* @property string|null $city
* @property int|null $country_id
* @property int|null $pre_phone_id
* @property string|null $phone
* @property int|null $pre_mobil_id
* @property string|null $mobil
* @property string|null $birthday
* @property string|null $website
* @property string|null $facebook
* @property string|null $facebook_fanpage
* @property string|null $instagram
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property-read \App\Models\Country|null $company_country
* @property-read \App\Models\Country|null $company_pre_phone
* @property-read \App\Models\Country|null $country
* @property-read \App\Models\Country|null $pre_mobil
* @property-read \App\Models\Country|null $pre_phone
* @property-read \App\User $user
* @method static bool|null forceDelete()
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account onlyTrashed()
* @method static bool|null restore()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereBirthday($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCity($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompany($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyCity($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyCountryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyHomepage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyPhone($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyPostalCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyPrePhoneId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCompanyStreet($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCountryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereFacebook($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereFacebookFanpage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereFirstName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereInstagram($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereLastName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereMobil($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account wherePhone($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account wherePostalCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account wherePreMobilId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account wherePrePhoneId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereSalutation($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereStreet($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereTitle($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereWebsite($value)
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account withoutTrashed()
* @mixin \Eloquent
*/
class Account extends Model
{
protected $table = 'accounts';
use SoftDeletes;
protected $dates = ['deleted_at'];
public function user()
{
return $this->belongsTo('App\User');
}
public function company_country()
{
return $this->belongsTo('App\Models\Country', 'company_country_id');
}
public function country()
{
return $this->belongsTo('App\Models\Country', 'country_id');
}
public function company_pre_phone()
{
return $this->belongsTo('App\Models\Country', 'company_pre_phone_id');
}
public function pre_phone()
{
return $this->belongsTo('App\Models\Country', 'pre_phone_id');
}
public function pre_mobil()
{
return $this->belongsTo('App\Models\Country', 'pre_mobil_id');
}
public function getCompanyAttribute(){
if(empty($this->attributes['company']) && @$this->attributes['company'] !== 0){
return 1;
}
return $this->attributes['company'];
}
}