PHP Snippet 1:
<form>
<div id="filters" class="flex flex-col text-gray-800">
<div>
<input type="number" wire:model.lazy="from" min="1970" max="{{ date('Y') }}">
@error('from')
<span class="text-red-800">{{ $message }}</span>
@enderror
</div>
<div>
<input type="number" wire:model.lazy="to" min="1970" max="{{ date('Y') }}">
@error('to')
<span class="text-red-800">{{ $message }}</span>
@enderror
</div>
<div>
<input type="text" wire:model.lazy="search">
@error('search')
<span class="text-red-800">{{ $message }}</span>
@enderror
</div>
</div>
</form>
PHP Snippet 2:
public function render()
{
$this->isValidInput = $this->getErrorBag()->count() == 0;
if ($this->isValidInput == false)
{
return view('customers.customer-search', ['customers' => Collection::empty()]);
}
else
{
return view('customers.customer-search',
['customers' => Customer::search($this->params)->paginate(10)]);
}
}
PHP Snippet 3:
<div>
<table>
<tr>
<th>Customer ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
@if ($customers->count() == 0)
<tr>
<td colspan="4" class="text-center">No matching results.</td>
</tr>
@else
@foreach($customers as $customer)
<tr>
<td>{!! $customer->CustID !!}</td>
<td>{!! $customer->NameFirst !!}</td>
<td>{!! $customer->NameLast !!}</td>
<td>{!! $customer->Email !!}</td>
</tr>
@endforeach
@endif
</table>
@if ($customers->count() > 0)
{{ $customers->links() }}
@endif
</div>