What seems to be the problem:
I am trying to use search in livewire and laravel 8.x but it gives error Call to undefined method Illuminate\Database\Eloquent\Builder::search().
Steps to Reproduce:
public $search = 't';
public function mount() {
$customerLocationCountry = Country::whereTranslation( 'name', Location::get()->countryName )->first();
$customerLocationCity = City::whereTranslation( 'name', Location::get()->cityName )->first();
$this->fill( [
'first_name' => Auth::user()->name,
'last_name' => Auth::user()->userInformation->lastname,
'mobile' => Auth::user()->userInformation->mobile,
'mobile_prefix' => $customerLocationCountry->code,
'countries' => $customerLocationCountry->id,
'cities' => $customerLocationCity->id,
] );
}
public function render() {
return view( 'livewire.customer-address.customer-address', [
'currentAddress' => Address::whereUsers( Auth::guard( 'web' )->id() )->search('address', $this->search )->get()
] )
->extends( 'customers.layout.index' )
->section( 'content' );
}
Are you using the latest version of Livewire:
2
Do you have any screenshots or code examples: