74 lines
1.7 KiB
PHP
74 lines
1.7 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 Illuminate\Support\Facades\Config;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @property string $public_employee_number
|
||
|
|
* @property string $last_name
|
||
|
|
* @property string $first_name
|
||
|
|
* @property \Carbon\Carbon $start_date
|
||
|
|
* @property \Carbon\Carbon|null $end_date
|
||
|
|
* @property \Carbon\Carbon|null $planned_end_date
|
||
|
|
* @property string $establishment
|
||
|
|
* @property string $site
|
||
|
|
* @property string $service
|
||
|
|
* @property \Carbon\Carbon|null $created_at
|
||
|
|
* @property \Carbon\Carbon|null $updated_at
|
||
|
|
*/
|
||
|
|
final class Employee extends Model
|
||
|
|
{
|
||
|
|
/** @use HasFactory<EmployeeFactory> */
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected static function newFactory(): EmployeeFactory
|
||
|
|
{
|
||
|
|
return EmployeeFactory::new();
|
||
|
|
}
|
||
|
|
|
||
|
|
#[\Override]
|
||
|
|
public function getConnectionName(): string
|
||
|
|
{
|
||
|
|
return Config::string('database.arcadia_meta_model');
|
||
|
|
}
|
||
|
|
|
||
|
|
protected $table = 'employees';
|
||
|
|
|
||
|
|
protected $primaryKey = 'public_employee_number';
|
||
|
|
|
||
|
|
public $incrementing = false;
|
||
|
|
|
||
|
|
protected $keyType = 'string';
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'public_employee_number',
|
||
|
|
'last_name',
|
||
|
|
'first_name',
|
||
|
|
'start_date',
|
||
|
|
'end_date',
|
||
|
|
'planned_end_date',
|
||
|
|
'establishment',
|
||
|
|
'site',
|
||
|
|
'service',
|
||
|
|
];
|
||
|
|
|
||
|
|
/** @return array<string, string> */
|
||
|
|
#[\Override]
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'start_date' => 'date',
|
||
|
|
'end_date' => 'date',
|
||
|
|
'planned_end_date' => 'date',
|
||
|
|
'created_at' => 'datetime',
|
||
|
|
'updated_at' => 'datetime',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|