searchBy = [ 'COMPANY' => 'Company', 'SNKEY' => 'Serverkey', 'CUR_VERSION' => 'Current Version', 'STATUS' => 'Status', 'DATABASETYPE' => 'Database', 'PHP_VERSION_ID' => 'PHP Version' ]; } public function render() { $query = ConfServerLicense::select('ID', 'SNKEY', 'COMPANY', 'STATUS', 'CUR_VERSION', 'DATABASETYPE', 'LICENSEDATE'); if ($this->searchSelected == 'PHP_VERSION_ID') { if ($this->keyword == '32') { if ($this->searchSelected && $this->keyword) { $query->whereIn('PHP_VERSION_ID', [0, 1]); } } elseif ($this->keyword == '64') { if ($this->searchSelected && $this->keyword) { $query->whereIn('PHP_VERSION_ID', [0, 2]); } } else { $query->whereIn('PHP_VERSION_ID', []); } } else { if ($this->searchSelected && $this->keyword) { $query->where($this->searchSelected, 'LIKE', '%' . $this->keyword . '%'); } } $query->orderBy('ID', 'DESC'); $results = $query->paginate($this->perPage); $this->totalItems = $results->total(); return view('livewire.pages.server-license.server-license-index', compact('results')); } public function updatedPerPage($value) { $this->adjustPageForNewPerPage(); } public function adjustPageForNewPerPage() { $lastPage = ceil($this->totalItems / $this->perPage); if ($this->page > $lastPage) { $this->setPage($lastPage); } } public function search() { $this->resetPage(); } public function showServerLicenseListForm() { $this->action = 'list'; } public function showServerLicenseAddForm() { $this->action = 'add'; } public function showServerLicenseEditForm($id) { $this->editId = $id; $this->action = 'edit'; // $this->emit('showpatchEditForm'); } public function showDeleteModal($id) { $this->emit('showDeleteModal', $id); } public function deleteItem($id) { $serverlicense = ConfServerLicense::where("ID", $id)->first(); $serverlicense->status = 'N'; $serverlicense->save(); $message = "Serverlicense status updated successfully"; $this->message = $message; } public function exportLicense() { return Excel::download(new ServerLicenseExport(), 'conf_server_license.xlsx'); } }