clean-code-studio / laravel-addresses
Laravel Addresses
dev-master
2019-06-29 04:13 UTC
Requires
- php: ^7.1.3
This package is auto-updated.
Last update: 2024-10-29 05:28:57 UTC
README
Any Laravel Model Can Have An Address
Installation
composer require clean-code-studio/laravel-addresses
php artisan migrate
Example Usage
SetUp Model (Ex: App\User.php)
use CleanCodeStudio\LaravelAddresses\CanHaveAddress;
class User extends Model
{
use CanHaveAddress;
}
Go to terminal and run: php artisan tinker
App\User::find(1)->address()->create(['city' => 'Kansas City', 'state' => 'Missouri', 'postal_code' => '53423', 'latitude' => '43534534']);
App\User::find(1)->address
// returns address created by userApp\Address::find(1)->owner
//returns user who created address
All Address Properties
city
state
country
postal_code
latitude
longitude
address_line_1
address_line_2