Sistema de controles da União de Ciclistas do Brasil
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 

50 lines
1.1 KiB

<?php
namespace App\Http\Livewire\Collaborators\Associates;
use App\Associate;
use Livewire\Component;
use Livewire\WithPagination;
class Index extends Component
{
use WithPagination;
/**
* The parameters that should sync with the URL query string
*
* @var array
*/
protected $updatesQueryString = [
'search' => ['except' => '']
];
/** @var string */
public $orderColumn = 'created_at';
/** @var string */
public $orderDirection = 'DESC';
/** @var int */
public $perPage = 10;
/** @var string */
public $search;
public function mount()
{
$this->search = request()->query('search', $this->search);
}
public function updatingSearch()
{
$this->resetPage();
}
public function render()
{
return view('livewire.collaborators.associates.index', [
'associates' => Associate::with('category')->where('name', 'LIKE', '%' . $this->search . '%')->orderBy($this->orderColumn, $this->orderDirection)->paginate($this->perPage),
]);
}
}