drapor/laravel-addresses

Helps you build multiple address storage like Amazon and PayPal have
51 1
Install
composer require drapor/laravel-addresses
Latest Version:0.2.2
PHP:>=5.3.0
Laravel:4
License:MIT
Last Updated:May 23, 2015
Links: GitHub  ·  Packagist
Maintainer: dondraper_

Laravel Addresses Plugin

Link a list of addresses to a user. Allows to flag address as primary, billing, or shipping. Users have many addresses, but only one primary or shipping or billing.

Sample views and controller are included. I don't recoment you use them directly, butjust use them as example code to copy and paste.

Composer Install
"require": {
    "rtconner/laravel-addresses": "dev-master"
}
Run the migrations
php artisan migrate --package=rtconner/laravel-addresses
Install the Service Provider
'providers' => array(
	'Conner\Addresses\AddressesServiceProvider',
),
Sample Usage
\Addresses::getAll($user->id); // get all users

if(Addresses::getValidator()->fails()) { } // validate before saving

$address = Addresses::createAddress(\Input::all()); // this does not auto-validate

$address = Addresses::updateAddress(\Input::all()); // this does not auto-validate

Addresses::deleteAddress($address);

Addresses::setPrimary($address); // set address as primary (and unset the others)

Addresses::getPrimary();    

Addresses::getShipping($userId);    

Addresses::getBilling();    
View Templates
@include('addresses::fields') <!-- bootstrap fields with no form tags -->

@foreach($addresses as $address)
	@include('addresses::view', compact('separator'=>'<br>')) <!-- read-only html of address -->
@endforeach 

You can make call direcly on the Conner\Addresses\Address model if you want. But you just have to be careful when reading/writing. The methods provided on \Addresses handle checks against the currently logged in user and making sure there are no duplicate primary addresses.

Related Packages

neuecommerce/addresses

Addresses is a polymorphic Laravel package, for addressbook management. Adding a...

19,550 2
yajra/laravel-address

Philippines Address Lookup API for Laravel.

24,434 41
nonsapiens/realaddressfactory

Creates real-world street addresses from Google Maps, to use in database seeding...

12,764 53
bureaupartners/extract-address-from-text

With this package you can extract the address from a unformatted text string

9,985 3
viviniko/address

VIVINIKO Address Service Provider

107 0

Version History

Version Released PHP Laravel License
0.2.2 >=5.3.0 >= 4.0.0 MIT
0.2.1 >=5.3.0 >= 4.0.0 MIT
0.2.0 >=5.4.0 4.1.* MIT