⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
crm.dev-unit.com
/
app
/
Http
/
Livewire
/
View File Name :
Customers.php
<?php namespace App\Http\Livewire; use App\Models\Customer; use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Contracts\View\View; use Illuminate\Database\Eloquent\Builder; class Customers extends SearchableComponent { public $searchByCustomer = ''; public $paginate = 15; /** * @return string[] */ public function searchableFields() { return [ 'company_name', ]; } /** * @return string */ public function model() { return Customer::class; } /** * @var string[] */ protected $listeners = [ 'refresh' => '$refresh', ]; /** * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|View */ public function render() { $customers = $this->searchCustomer(); return view('livewire.customers', compact('customers'))->with('searchByCustomer'); } /** * @return LengthAwarePaginator */ public function searchCustomer() { $query = $this->getQuery()->withCount(['contact', 'project', 'customerGroups'])->latest(); $query->when(! empty($this->searchByCustomer != ''), function (Builder $query) { $query->Where('company_name', 'like', '%'.strtolower($this->searchByCustomer).'%'); }); return $this->paginate(); } public function updatingSearch() { $this->resetPage(); } }