PHP code example of jobmetric / laravel-location

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

    

jobmetric / laravel-location example snippets


use JobMetric\Location\Facades\Country;

$response = Country::store([
    'name' => 'Iran',
    'flag' => 'iran.svg',
    'mobile_prefix' => 98,
    'validation' => [
        '/^9\\d{9}$/',
    ],
    'address_on_letter' => "{country}, {province}, {city}\n{district}, {street}, {number}",
    'status' => true,
]);

use Illuminate\Database\Eloquent\Model;
use JobMetric\Location\HasAddress;
use JobMetric\Location\HasGeoArea;

class User extends Model
{
    use HasAddress;
}

class Shipping extends Model
{
    use HasGeoArea;
}
bash
php artisan migrate
bash
php artisan vendor:publish --provider="JobMetric\\Location\\LocationServiceProvider"