azishapidin / indoregion

Package Laravel wilayah Indonesia | Data Provinsi, Kabupaten/Kota, Kecamatan dan Kelurahan/Desa seluruh Indonesia.
https://packagist.org/packages/azishapidin/indoregion
MIT License
247 stars 85 forks source link

error regency get by province #15

Closed destiaarti closed 4 years ago

destiaarti commented 4 years ago

// Get Kabupaten/Kota dari sebuah Provinsi $regencies = $province->regencies; controller saya: use App\Models\Province; use App\Models\Regency; use App\Models\District; use App\Models\Village; public function regency($province) { $regencies = $province->regencies; return response()->json($regencies); } route saya: Route::get('/regency/{province}','RegionController@regency');

hasil : ErrorException: Trying to get property 'regencies' of non-object in ...

itu knp ya mas @azishapidin ? ada yg kurang kah, saya sudah sesuai github untuk instalasinya, saya pakai laravel 7.

destiaarti commented 4 years ago

uda solve mas, saya lihat dari https://github.com/azishapidin/indoregion/issues/10

azishapidin commented 4 years ago

Coba periksa $province nya pake dd($province)

On Wed, 9 Sep 2020 at 12.26 destiaarti notifications@github.com wrote:

// Get Kabupaten/Kota dari sebuah Provinsi

$regencies = $province->regencies;

controller saya:

use App\Models\Province;

use App\Models\Regency;

use App\Models\District;

use App\Models\Village;

public function regency($province)

{

$regencies = $province->regencies;

return response()->json($regencies);

}

route saya:

Route::get('/regency/{province}','RegionController@regency');

hasil :

ErrorException: Trying to get property 'regencies' of non-object in ...

itu knp ya mas @azishapidin https://github.com/azishapidin ? ada yg kurang kah, saya sudah sesuai github untuk instalasinya, saya pakai laravel 7.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/azishapidin/indoregion/issues/15, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZGPGL5TCVHMLZR3UPGJUTSE4GXXANCNFSM4RBDNWYA .

destiaarti commented 4 years ago

uda solve ko mas hehe, trnyata hrs manggil model dulu . jadi bentuknya objek gitu. sebelumnya saya kan manggilnya si id langsung, saya kira sama macam api lokasi rajaongkir. Jd parameternya langsung id gitu. makasii mas hehehe