Skip to content
This repository has been archived by the owner on Jun 26, 2022. It is now read-only.

Declaration of Techouse\\SelectAutoComplete\\SelectAutoComplete::placeholder(string $placeholer) should be compatible with Laravel\\Nova\\Fields\\Field::placeholder($text) #20

Open
PaulLawton227 opened this issue Dec 9, 2020 · 2 comments

Comments

@PaulLawton227
Copy link

select auto complete: v1.3.6
nova: 3.15.0
laravel: v8.15.0

This code below used to work on older versions, but we have recently upgraded to all the latest versions of laravel/nova/ etc.

I now get this error:

Declaration of Techouse\\SelectAutoComplete\\SelectAutoComplete::placeholder(string $placeholer) should be compatible with Laravel\\Nova\\Fields\\Field::placeholder($text)

when running the following code:

 Select::make(__('Customer'), 'customer_id')
                ->options(\App\Customer::all()->mapWithKeys(function ($customer) {
                    return [$customer->id => $customer->first_name . ' ' . $customer->last_name . " (" . $customer->email . ")"];
                }))
                ->displayUsingLabels()
@PaulLawton227
Copy link
Author

PaulLawton227 commented Dec 9, 2020

changing the placeholder method to:

public function placeholder($text)
    {
        if ($text) {
            $this->placeholder = trim($text);

            return $this->withMeta([__FUNCTION__ => $this->placeholder]);
        }
    }

fixes the issue.

Can we get this updated in the main repo code?

@techouse
Copy link
Owner

changing the placeholder method to:

public function placeholder($text)
    {
        if ($text) {
            $this->placeholder = trim($text);

            return $this->withMeta([__FUNCTION__ => $this->placeholder]);
        }
    }

fixes the issue.

Can we get this updated in the main repo code?

Make a PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants