F
Filamentβ€’13mo ago
nostrodamned

Cant access instantiated class

use Livewire\Component;
use App\Services\FlightApiService;

class FlightDepartureAutocomplete extends Component
{
public $search;
public $autocompleteResults;
protected ?FlightApiService $flightApiService = null;

public function mount(FlightApiService $flightApiService): void
{
$this->flightApiService = $flightApiService;

}

public function updatedSearch(): void
{
$params = [
'string' => $this->search
];

dd($this->flightApiService);
}
use Livewire\Component;
use App\Services\FlightApiService;

class FlightDepartureAutocomplete extends Component
{
public $search;
public $autocompleteResults;
protected ?FlightApiService $flightApiService = null;

public function mount(FlightApiService $flightApiService): void
{
$this->flightApiService = $flightApiService;

}

public function updatedSearch(): void
{
$params = [
'string' => $this->search
];

dd($this->flightApiService);
}
This is my livewire component for use on a custom filamentphp page, this
$this->flightApiService = $flightApiService;
$this->flightApiService = $flightApiService;
when i dd the flight api service is instantiated but not in the updatedSearch Method - it returns null. What am i missing πŸ™‚
1 Reply
nostrodamned
nostrodamnedβ€’13mo ago
Got it - had to add it to boot method not mount