1. Go to this page and download the library: Download matriphe/laraciproid library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public function run()
{
Model::unguard();
$this->call('LaraciproidSeeder');
}
// Get all cities under DI Yogyakarta (province_id = 34)
$cities = App\Models\Province::find(34)->cities;
foreach ($cities as $city) {
// Do something
}
// Get province name of Bogor (city_id = 3271)
$city = App\Models\City::find(3271);
$province_name = $city->province->province_name;