PHP code example of rep98 / laravel-venezuela

1. Go to this page and download the library: Download rep98/laravel-venezuela 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/ */

    

rep98 / laravel-venezuela example snippets


use Rep98\Venezuela\Models\State;

var_dump(State::all());

use Rep98\Venezuela\Models\Parish;

$parishes = Parish::with('municipality.state')->get();

var_dump($parishes);
 
// File Model/Industry.php
use Rep98\Venezuela\Traits\HasMunicipality;
use Illuminate\Database\Eloquent\Model;
class Industry extends Model {
    use HasMunicipality;
    protected $fillable = ['name', 'rif'];
}
// File Controller/IndustryController.php

$industry = Industry::find(1);
$industry->municipalities;
// Inverso
use Rep98\Venezuela\Models\Municipality;

$municipality = Municipality::find(1);

$municipality->models;

    use Rep98\Venezuela\Models\Direction;
    Direction::register('Bolivariano de Miranda', 'Charallave');
    
shell
$ php artisan vendor:publish --tag=venezuela-config
$ php artisan vendor:publish --tag=venezuela-migrations
$ php artisan vendor:publish --tag=venezuela-seeders