feat(ISP config web and webhost imports)
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 43s
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 43s
This commit is contained in:
31
app/Models/IspconfigMember.php
Normal file
31
app/Models/IspconfigMember.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\IspconfigType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class IspconfigMember extends Model
|
||||
{
|
||||
protected $table = 'ispconfigs_members';
|
||||
|
||||
protected $fillable = [
|
||||
'member_id',
|
||||
'ispconfig_client_id',
|
||||
'ispconfig_service_user_id',
|
||||
'email',
|
||||
'type',
|
||||
'data',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'type' => IspconfigType::class,
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
public function member(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Member::class);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\IspconfigType;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -122,4 +123,23 @@ class Member extends Model
|
||||
{
|
||||
return $this->hasMany(Membership::class);
|
||||
}
|
||||
|
||||
public function ispconfigs(): HasMany
|
||||
{
|
||||
return $this->hasMany(IspconfigMember::class, 'member_id');
|
||||
}
|
||||
|
||||
public function ispconfigMail(): ?IspconfigMember
|
||||
{
|
||||
return $this->ispconfigs()
|
||||
->where('type', IspconfigType::MAIL)
|
||||
->first();
|
||||
}
|
||||
|
||||
public function ispconfigWeb(): ?IspconfigMember
|
||||
{
|
||||
return $this->ispconfigs()
|
||||
->where('type', IspconfigType::WEB)
|
||||
->first();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user