Skip to content

Commit

Permalink
b.transfer authoriztion
Browse files Browse the repository at this point in the history
  • Loading branch information
alkadoHs committed Feb 14, 2024
1 parent 5aeaba2 commit bb1e69d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Filament/Resources/BranchTransferResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ public static function table(Table $table): Table
])
->modifyQueryUsing(function (Builder $query) {
if(auth()->user()->role != 'admin') {
return $query->with('fromBranch', 'toBranch', 'receiver', 'product.mainProduct')->orderBy('updated_at', 'desc');
return $query->with('fromBranch', 'toBranch', 'receiver', 'product.mainProduct')
->where('from_branch_id', auth()->user()->branch_id)
->orWhere('to_branch_id', auth()->user()->branch_id)
->orderBy('updated_at', 'desc');
}
return $query->with('fromBranch', 'toBranch', 'receiver', 'product.mainProduct')->orderBy('updated_at', 'desc');
})
Expand Down

0 comments on commit bb1e69d

Please sign in to comment.