Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| InfluencerTable | |
0.00% |
0 / 14 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| updatingSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| render | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Livewire\Admin; |
| 4 | |
| 5 | use App\Http\Controllers\Concerns\ResolvesContext; |
| 6 | use App\Models\Influencer; |
| 7 | use Livewire\Component; |
| 8 | use Livewire\WithPagination; |
| 9 | |
| 10 | class InfluencerTable extends Component |
| 11 | { |
| 12 | use ResolvesContext, WithPagination; |
| 13 | |
| 14 | public string $search = ''; |
| 15 | |
| 16 | public function updatingSearch(): void |
| 17 | { |
| 18 | $this->resetPage(); |
| 19 | } |
| 20 | |
| 21 | public function render() |
| 22 | { |
| 23 | $store = $this->currentStore(); |
| 24 | |
| 25 | return view('livewire.admin.influencer-table', [ |
| 26 | 'influencers' => Influencer::query() |
| 27 | ->with('activeCoupon') |
| 28 | ->where('store_id', $store->id) |
| 29 | ->when($this->search, fn ($q) => $q->where(function ($query) { |
| 30 | $query->where('name', 'like', '%'.$this->search.'%') |
| 31 | ->orWhere('email', 'like', '%'.$this->search.'%') |
| 32 | ->orWhere('instagram', 'like', '%'.$this->search.'%'); |
| 33 | })) |
| 34 | ->latest() |
| 35 | ->paginate(15), |
| 36 | ]); |
| 37 | } |
| 38 | } |