PHP code example of matriphe / laraciproid

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/ */

    

matriphe / laraciproid example snippets


'providers' => [
	...
	Matriphe\Laraciproid\ServiceProvider::class,
	...
],

'providers' => [
        ...
        'Matriphe\Laraciproid\ServiceProvider',
        ...
],

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;
bash
php artisan vendor:publish
bash
php artisan vendor:publish --provider="Matriphe\Laraciproid\ServiceProvider" --force
bash
php artisan migrate
bash
php artisan db:seed --class=LaraciproidSeeder