38 lines
822 B
PHP
38 lines
822 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
|
|
class CorporatePolicy extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'corporate_id',
|
|
'code',
|
|
'total_premi',
|
|
'minimal_deposit_percentage',
|
|
'minimal_deposit_net',
|
|
'minimal_alert_percentage',
|
|
'minimal_alert_net',
|
|
'minimal_stop_service_percentage',
|
|
'minimal_stop_service_net',
|
|
'start',
|
|
'end',
|
|
'active',
|
|
];
|
|
|
|
public function corporate()
|
|
{
|
|
return $this->belongsTo(Corporate::class);
|
|
}
|
|
|
|
public function setCodeAttribute($value)
|
|
{
|
|
$this->attributes['code'] = !empty($value) ? $value : Str::upper(Str::random('6'));
|
|
}
|
|
}
|