presseportale/dev/Models/Company.php
Kevin Adametz 405df0a122
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
first commit
2025-10-20 17:53:02 +02:00

137 lines
4.2 KiB
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class Company
*
* @property int $id
* @property string $name
* @property string $address
* @property int $country_id
* @property string $phone
* @property string|null $fax
* @property string $email
* @property string $website
* @property string|null $logo
* @property string $ctype
* @property string|null $login
* @property string|null $password
* @property int|null $is_active
* @property int|null $user_id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $slug
* @property int $disable_footer_code
* @property Country $country
* @property SfGuardUser|null $sf_guard_user
* @property CompanyUser $company_user
* @property Collection|Contact[] $contacts
* @property Collection|PressRelease[] $press_releases
* @property ResponsibleCompanyUser $responsible_company_user
* @property Collection|UserPaymentOption[] $user_payment_options
* @package App\Models
* @property-read int|null $contacts_count
* @property-read int|null $press_releases_count
* @property-read int|null $user_payment_options_count
* @method static \Illuminate\Database\Eloquent\Builder|Company newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Company newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Company query()
* @method static \Illuminate\Database\Eloquent\Builder|Company whereAddress($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereCountryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereCtype($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereDisableFooterCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereFax($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereIsActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereLogin($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereLogo($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company wherePhone($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereWebsite($value)
* @mixin \Eloquent
*/
class Company extends Model
{
protected $table = 'company';
protected $casts = [
'country_id' => 'int',
'is_active' => 'int',
'user_id' => 'int',
'disable_footer_code' => 'int'
];
protected $hidden = [
'password'
];
protected $fillable = [
'name',
'address',
'country_id',
'phone',
'fax',
'email',
'website',
'logo',
'ctype',
'login',
'password',
'is_active',
'user_id',
'slug',
'disable_footer_code'
];
public function country()
{
return $this->belongsTo(Country::class);
}
public function sf_guard_user()
{
return $this->belongsTo(SfGuardUser::class, 'user_id');
}
public function company_user()
{
return $this->hasOne(CompanyUser::class);
}
public function contacts()
{
return $this->hasMany(Contact::class);
}
public function press_releases()
{
return $this->hasMany(PressRelease::class);
}
public function responsible_company_user()
{
return $this->hasOne(ResponsibleCompanyUser::class);
}
public function user_payment_options()
{
return $this->belongsToMany(UserPaymentOption::class, 'user_payment_option_company', 'company_id', 'payment_option_id')
->withPivot('ip_address', 'is_active')
->withTimestamps();
}
}