wip controll and repair
This commit is contained in:
1 parent
4a509c6a16
commit
3dd1dad42f
19 files changed
+182
-91
No files matched your search
@@ -29,12 +29,12 @@ class ProjektesTable
|
||||
->columns([
|
||||
TextColumn::make('id')->sortable(),
|
||||
ToggleColumn::make('meine')
|
||||
->state(fn ($record) => ProjektUser::where('user_id', auth()->user()->id)->where('projekte_id', $record->id)->count())
|
||||
->state(fn ($record) => ProjektUser::where('user_id', Auth::user()->id)->where('projekte_id', $record->id)->count())
|
||||
->beforeStateUpdated(function ($record, $state) {
|
||||
if ($state) {
|
||||
ProjektUser::create(['user_id' => auth()->user()->id, 'projekte_id' => $record->id]);
|
||||
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $record->id]);
|
||||
} else {
|
||||
ProjektUser::where('user_id', auth()->user()->id)->where('projekte_id', $record->id)->delete();
|
||||
ProjektUser::where('user_id', Auth::user()->id)->where('projekte_id', $record->id)->delete();
|
||||
}
|
||||
}),
|
||||
TextColumn::make('interner_name')
|
||||
@@ -71,7 +71,7 @@ class ProjektesTable
|
||||
$data['meine'],
|
||||
function (Builder $query, $meine) {
|
||||
$query->whereHas('projekt_users', function ($query) {
|
||||
$query->where('projekt_users.user_id', auth()->user()->id);
|
||||
$query->where('projekt_users.user_id', Auth::user()->id);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user