Closed devjk1 closed 3 years ago
I don't understand why you are using livewire.
(livewire dot) as prefix. Based on how its being registered, should either be <livewire:domestic-address-search-bar />
or @livewire('domestic-address-search-bar')
edit: add ->hasViews()
to the AddressesServiceProvider (I misunderstood where the "livewire dot" syntax was being used)
The Demo app cannot find the view on line 66 in AddressesServiceProvider
No hint path defined for [addresses].
Also making a Service from the outside package, Laravel-google-api
The TipoffPackage class does not contain an array for Views, like it does for NovaResources and Policies. I cannot pass more than 1 view to the method hasViews( )
The TipoffPackage class does not contain an array for Views, like it does for NovaResources and Policies. I cannot pass more than 1 view to the method hasViews( )
You don't pass it any parameters -- you just need to declare the package has views.
I think this should be good to go now. All tests are throwing this error
Illuminate\Contracts\Container\BindingResolutionException: Target class [livewire] does not exist.
For use in a 'Project Instance', I believe you do this.
Javascript version use view('addresses::domestic-address-search-bar-javascript')
Livewire version use normally @livewire('domestic-address-search-bar')
For use in a 'Project Instance', I believe you do this. Javascript version use
view('addresses::domestic-address-search-bar-javascript')
Livewire version use normally@livewire('domestic-address-search-bar')
Correct (or <livewire:domestic-address-search-bar/>
), but not sure why @drewroberts wants both a livewire and a non-livewire version. Since both depend on javascript, having 2 different implementations of the same thing doesn't make sense to me. More testing, harder maintenance, etc
Pulling a Service 'PlacesApi', but returns null https://github.com/tipoff/addresses/blob/15bc48b3c4ee34444643ccd4cccfbcfdf86eeb23/src/Http/Livewire/DomesticAddressSearchBar.php#L25-L29
Service is from laravel-google-api Package here https://github.com/tipoff/laravel-google-api/blob/59b98f33e1d624bed5942e580c7655e33d4135e3/src/GoogleApiServiceProvider.php#L73-L79
it accepts 3 params from env, and can all be null (I set the key in demo)
(fixed) Not allowed to use Object/Service as Livewire component Property
The service IS null
Call to a member function placeAutocomplete() on null
https://github.com/tipoff/addresses/blob/15bc48b3c4ee34444643ccd4cccfbcfdf86eeb23/src/Http/Livewire/DomesticAddressSearchBar.php#L91-L94
To use this Livewire component in a Demo app, render the stack (JS portion of Livewire component) in the head of the layout file stack named 'domestic-address-search-bar'
ex. layouts.app
<head>
...
@livewireStyles
@stack ('addresses::domestic-address-search-bar')
</head>
<body>
@yield ('content')
@livewireScripts
</body>
ex. view-that-uses-search-bar-component
@extends ('layouts.app')
@section ('content')
@livewire ('addresses::domestic-address-search-bar')
@endsection
--fixed-- Have a working draft. You can test on the Demo app, I made a branch called "setup" Endpoint is "/test" Add to .env GOOGLE_PLACES_API_KEY="" GOOGLE_PLACES_VERIFY_SSL=true
There is still a bug where Google is returning partial addresses, when the search box query does not start with a number. Make sure to start queries with numbers to get exact addresses. Drew I will incorporate the changes you mentioned, but I wanted to get a draft out.
@devjk1 All tests are green now.
Updated the Livewire component
Note: This Livewire version must handle session tokens manually. The Javascript version it is handled automatically with Google classes. I am using the Laravel helper Str::uuid(). Since all instances of TGER apps will be using one Places API key, I believe the session tokens must be unique across all app instances.. or else large costs. I am not sure if Str::uuid() can accomplish making unique UUID's across all app instances.
We tried running this in the Demo app, but getting errors trying to pull in this component. I believe it is because the resources folder is on the same level as 'src'. Errors: View [livewire.domestic-address-search-bar] not found. If we added the package name in livewire component DomesticAddressSearchBar::render,
public function render() { return view('addresses::livewire.domestic-address-search-bar'); }
we got this error No hint path defined for [addresses].