82 lines
2.1 KiB
PHP
82 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Infra\Database\Models;
|
|
|
|
use Database\Factories\EmployeeFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Infra\Casts\UtcDateTimeCast;
|
|
use Infra\Config\ArcadiaStorageConfig;
|
|
|
|
/**
|
|
* @property string $public_employee_number
|
|
* @property string $last_name
|
|
* @property string $first_name
|
|
* @property \DateTimeImmutable $start_date
|
|
* @property \DateTimeImmutable|null $end_date
|
|
* @property \DateTimeImmutable|null $planned_end_date
|
|
* @property string $establishment
|
|
* @property string $site
|
|
* @property string $service
|
|
* @property \DateTimeImmutable|null $created_at
|
|
* @property \DateTimeImmutable|null $updated_at
|
|
*
|
|
* @method static \Database\Factories\EmployeeFactory factory($count = null, $state = [])
|
|
*
|
|
* @mixin \Eloquent
|
|
*/
|
|
final class Employee extends Model
|
|
{
|
|
/** @use HasFactory<EmployeeFactory> */
|
|
use HasFactory;
|
|
|
|
protected static function newFactory(): EmployeeFactory
|
|
{
|
|
return EmployeeFactory::new();
|
|
}
|
|
|
|
#[\Override]
|
|
public function getConnectionName(): string
|
|
{
|
|
return resolve(ArcadiaStorageConfig::class)->databaseConnection;
|
|
}
|
|
|
|
protected $table = 'employees';
|
|
|
|
protected $primaryKey = 'public_employee_number';
|
|
|
|
public $incrementing = false;
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $keyType = 'string';
|
|
|
|
protected $fillable = [
|
|
'public_employee_number',
|
|
'last_name',
|
|
'first_name',
|
|
'start_date',
|
|
'end_date',
|
|
'planned_end_date',
|
|
'establishment',
|
|
'site',
|
|
'service',
|
|
'created_at',
|
|
'updated_at',
|
|
];
|
|
|
|
/** @return array<string, string> */
|
|
#[\Override]
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'start_date' => UtcDateTimeCast::class,
|
|
'end_date' => UtcDateTimeCast::class,
|
|
'planned_end_date' => UtcDateTimeCast::class,
|
|
'created_at' => UtcDateTimeCast::class,
|
|
'updated_at' => UtcDateTimeCast::class,
|
|
];
|
|
}
|
|
}
|