This commit is contained in:
salam committed 2025-09-09 18:01:53 +02:00
1 parent 3072012c07
commit 2cb88a4290
12 files changed
+170 -156

No files matched your search

+7
View File
@@ -2,10 +2,17 @@
namespace App\Models;
// use App\Models\Scopes\KontoScope;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Gutachter extends Model
{
use SoftDeletes;
// protected static function booted(): void
// {
// static::addGlobalScope(new KontoScope);
// }
}
+11 -1
View File
@@ -2,9 +2,19 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class Konto extends Model
{
//
// protected static function booted(): void
// {
// static::addGlobalScope('konto', function (Builder $query) {
// if (auth()->hasUser()) {
// $query->where('konto_id', auth()->user()->konto_id);
// // or with a `team` relationship defined:
// // $query->whereBelongsTo(auth()->user()->team);
// }
// });
// }
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models\Scopes;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
class KontoScope implements Scope
{
/**
* Apply the scope to a given Eloquent query builder.
*/
public function apply(Builder $builder, Model $model): void
{
$builder->where('konto_id', auth()->user()->konto_id);
}
}
+8
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\Scopes\KontoScope;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
use Filament\Auth\MultiFactor\Email\Contracts\HasEmailAuthentication;
@@ -27,6 +28,7 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
protected $fillable = [
'name',
'email',
'konto_id',
'password',
'super_admin',
'app_verified_at',
@@ -70,6 +72,12 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
];
}
// protected static function booted(): void
// {
// static::addGlobalScope(new KontoScope);
// }
public function getAppAuthenticationSecret(): ?string
{
// This method should return the user's saved app authentication secret.