mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
41 lines
822 B
PHP
41 lines
822 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
/**
|
|
* Class Employee
|
|
* @package App\Models
|
|
*
|
|
* @property int $company_id
|
|
* @property int $user_id
|
|
*/
|
|
class Employee extends AbstractModel
|
|
{
|
|
protected $table = 'employees';
|
|
|
|
/**
|
|
* @return HasMany
|
|
*/
|
|
public function company(): HasMany
|
|
{
|
|
return $this->HasMany(Company::class, 'company_id', 'id');
|
|
}
|
|
|
|
public function user(): HasOne
|
|
{
|
|
return $this->hasOne(User::class, 'user_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* @return belongsToMany
|
|
*/
|
|
public function milestones()
|
|
{
|
|
return $this->belongsToMany(Milestone::class, 'milestone_progress', 'user_id', 'milestone_id')
|
|
->withPivot('created_at');
|
|
}
|
|
}
|