WorkerAutoliftOption.php
827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $employer_id
* @property bool $autolift_site
* @property int $times_per_day
* @property int $days_repeat
* @property string $time_send_first
* @property string $time_send_second
* @property string $time_send_third
* @property bool $is_enabled
*/
class WorkerAutoliftOption extends Model
{
protected $guarded = [
'created_at',
'updated_at'
];
public function isEnabled(): Attribute
{
return Attribute::make(
get: fn ($value) => $value === null ? 0 : 1
);
}
public function worker(): BelongsTo
{
return $this->belongsTo(Worker::class);
}
}