mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 12:34:01 +00:00
75 lines
1.3 KiB
PHP
75 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\AbstractModel as Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
|
/**
|
|
* Class Contact
|
|
* @package App\Models
|
|
* @version August 5, 2020, 10:46 pm
|
|
*
|
|
* @property \App\Models\Company company
|
|
* @property string name
|
|
* @property string designation
|
|
* @property string email
|
|
* @property string phone
|
|
* @property string wechat_id
|
|
*/
|
|
class Contact extends AbstractModel
|
|
{
|
|
|
|
use SoftDeletes;
|
|
|
|
|
|
protected $table = 'contacts';
|
|
|
|
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
|
|
|
public $fillable = [
|
|
'name',
|
|
'designation',
|
|
'email',
|
|
'phone',
|
|
'wechat_id'
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be casted to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'name' => 'string',
|
|
'designation' => 'string',
|
|
'email' => 'string',
|
|
'phone' => 'string',
|
|
'wechat_id' => 'string'
|
|
];
|
|
|
|
/**
|
|
* Validation rules
|
|
*
|
|
* @var array
|
|
*/
|
|
public static $rules = [
|
|
'company_id' => 'required',
|
|
'name' => 'required'
|
|
];
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
|
**/
|
|
public function company(): HasOne
|
|
{
|
|
return $this->hasOne(\App\Models\Company::class, 'company_id', 'id');
|
|
}
|
|
|
|
}
|