Update Member Import
This commit is contained in:
@@ -16,7 +16,12 @@ class Corporate extends Model
|
||||
'name',
|
||||
'welcome_message',
|
||||
'help_text',
|
||||
'active'
|
||||
'active',
|
||||
'linking_rules',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'linking_rules' => 'array',
|
||||
];
|
||||
|
||||
public function imports()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -12,6 +13,7 @@ class CorporatePolicy extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'corporate_id',
|
||||
// 'policy_id',
|
||||
'code',
|
||||
'total_premi',
|
||||
'minimal_deposit_percentage',
|
||||
@@ -34,4 +36,19 @@ class CorporatePolicy extends Model
|
||||
{
|
||||
$this->attributes['code'] = !empty($value) ? $value : Str::upper(Str::random('6'));
|
||||
}
|
||||
|
||||
// public function setPolicyIdAttribute($value)
|
||||
// {
|
||||
// $this->attributes['policy_id'] = !empty($value) ? $value : Str::upper(Str::random('6'));
|
||||
// }
|
||||
|
||||
public function setStartAttribute($value)
|
||||
{
|
||||
$this->attributes['start'] = !empty($value) ? Carbon::parse($value)->format('Y-m-d') : null;
|
||||
}
|
||||
|
||||
public function setEndAttribute($value)
|
||||
{
|
||||
$this->attributes['end'] = !empty($value) ? Carbon::parse($value)->format('Y-m-d') : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class Member extends Model
|
||||
|
||||
public function policies()
|
||||
{
|
||||
return $this->hasMany(MemberPolicy::class, 'member_id');
|
||||
return $this->hasMany(MemberPolicy::class, 'member_id', 'member_id');
|
||||
}
|
||||
|
||||
public function scopeFilter($query, array $filters)
|
||||
|
||||
@@ -28,4 +28,14 @@ class MemberPolicy extends Model
|
||||
{
|
||||
return $this->belongsTo(Member::class, 'member_id', 'member_id');
|
||||
}
|
||||
|
||||
// public function setStartAttribute($value)
|
||||
// {
|
||||
// $this->attributes['start'] = $value ? strtotime($value) : null;
|
||||
// }
|
||||
|
||||
// public function setEndAttribute($value)
|
||||
// {
|
||||
// $this->attributes['end'] = $value ? strtotime($value) : null;
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user