85 lines
2.6 KiB
PHP
85 lines
2.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Contact
|
|
*
|
|
* @property int $id
|
|
* @property int $company_id
|
|
* @property int $salutation_id
|
|
* @property string|null $title
|
|
* @property string $first_name
|
|
* @property string $last_name
|
|
* @property string|null $responsibility
|
|
* @property string|null $phone
|
|
* @property string|null $fax
|
|
* @property string $email
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
* @property Company $company
|
|
* @property Salutation $salutation
|
|
* @property Collection|PressRelease[] $press_releases
|
|
* @package App\Models
|
|
* @property-read int|null $press_releases_count
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereCompanyId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereEmail($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereFax($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereFirstName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereLastName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact wherePhone($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereResponsibility($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereSalutationId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereTitle($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Contact whereUpdatedAt($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Contact extends Model
|
|
{
|
|
protected $table = 'contact';
|
|
|
|
protected $casts = [
|
|
'company_id' => 'int',
|
|
'salutation_id' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'company_id',
|
|
'salutation_id',
|
|
'title',
|
|
'first_name',
|
|
'last_name',
|
|
'responsibility',
|
|
'phone',
|
|
'fax',
|
|
'email'
|
|
];
|
|
|
|
public function company()
|
|
{
|
|
return $this->belongsTo(Company::class);
|
|
}
|
|
|
|
public function salutation()
|
|
{
|
|
return $this->belongsTo(Salutation::class);
|
|
}
|
|
|
|
public function press_releases()
|
|
{
|
|
return $this->belongsToMany(PressRelease::class, 'press_release_contact');
|
|
}
|
|
}
|