client = $client; } public function statusChange($status) { if (in_array($status, $this->status)) { return $this->status = array_diff($this->status, [$status]); } array_push($this->status, $status); } public function render() { $query = $this->client->documents(); if (in_array('resources', $this->status) && ! in_array('client', $this->status)) { $query = $query->where('documentable_type', '!=', \App\Models\Client::class); } if (in_array('client', $this->status) && ! in_array('resources', $this->status)) { $query = $query->where('documentable_type', \App\Models\Client::class); } $query = $query ->where('is_public', true) ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc') ->paginate($this->per_page); return render('components.livewire.documents-table', [ 'documents' => $query, ]); } }