Fixes for client documents query

This commit is contained in:
David Bomba 2025-01-20 08:36:44 +11:00
parent d71e084f63
commit eb574f3444
1 changed files with 5 additions and 3 deletions

View File

@ -118,12 +118,14 @@ class DocumentsTable extends Component
protected function documents()
{
return $this->client()->documents()
$client = $this->client();
return $client->documents()
->where('is_public', true)
->orWhere(function ($query){
$query->whereHasMorph('documentable', [Company::class], function ($q) {
$q->where('is_public', true);
$query->whereHasMorph('documentable', [Company::class], function ($q) use ($client) {
$q->where('is_public', true)->where('company_id', $client->company_id);
});
});