fix(NextCloud members and script - part 1)
This commit is contained in:
@@ -109,6 +109,12 @@ class Member extends Model
|
||||
return "{$this->firstname} {$this->lastname}";
|
||||
}
|
||||
|
||||
public function getRetzienEmailAttribute(): string
|
||||
{
|
||||
$emails = explode(';', $this->email);
|
||||
return collect($emails)->filter(fn($email) => str_contains($email, '@retzien.fr'))->first();
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
@@ -142,4 +148,9 @@ class Member extends Model
|
||||
->where('type', IspconfigType::WEB)
|
||||
->first();
|
||||
}
|
||||
|
||||
public function nextcloudAccounts(): HasMany
|
||||
{
|
||||
return $this->hasMany(NextCloudMember::class, 'member_id');
|
||||
}
|
||||
}
|
||||
|
||||
27
app/Models/NextCloudMember.php
Normal file
27
app/Models/NextCloudMember.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\IspconfigType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class NextCloudMember extends Model
|
||||
{
|
||||
protected $table = 'nextclouds_members';
|
||||
|
||||
protected $fillable = [
|
||||
'member_id',
|
||||
'nextcloud_user_id',
|
||||
'data',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
public function member(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Member::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user