56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Wage extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'period_start',
|
|
'period_end',
|
|
'sessions_count',
|
|
'hours_worked',
|
|
'base_amount',
|
|
'bonus',
|
|
'deductions',
|
|
'total_amount',
|
|
'currency_id',
|
|
'status',
|
|
'notes',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'period_start' => 'date',
|
|
'period_end' => 'date',
|
|
'sessions_count' => 'integer',
|
|
'hours_worked' => 'integer',
|
|
'base_amount' => 'decimal:2',
|
|
'bonus' => 'decimal:2',
|
|
'deductions' => 'decimal:2',
|
|
'total_amount' => 'decimal:2',
|
|
];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function currency(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Currency::class);
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
}
|