1. Go to this page and download the library: Download chuckcms/laravel-addresses 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/ */
chuckcms / laravel-addresses example snippets
namespace App\Models;
use Chuckcms\Addresses\Traits\HasAddresses;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasAddresses;
// ...
}
$post = Post::first();
$post->addAddress([
'label' => 'My address', // '100', // defaults to: null
'housenumber_postfix' => 'B1', // defaults to: null
'postal_code' => '10001', // defaults to: null
'city' => 'Chuck City', // defaults to: null
'state' => 'New Chuck State', // defaults to: null
'country' => 'Chuckland', // defaults to: null
'latitude' => 51.13128, // defaults to: null
'longitude' => 4.57041, // defaults to: null
'is_primary' => true, // defaults to: false
'is_billing' => false, // defaults to: false
'is_shipping' => false, // defaults to: false
]);