sfneal/address

Add polymorphic 'address' relationships to Eloquent Models in Laravel applications

2.0.2 2024-04-01 20:18 UTC

README

Packagist PHP support Latest Version on Packagist Build Status StyleCI Scrutinizer Code Quality Total Downloads

Add polymorphic 'address' relationships to Eloquent Models in Laravel applications.

Installation

You can install the package via composer:

composer require sfneal/address

To make use of database migration, publish the Service Provider.

php artisan vendor:publish --provider="Sfneal\Address\Providers\AddressServiceProvider"

Usage

Add a 'address' relationship to an Eloquent Model.

use Illuminate\Database\Eloquent\Relations\MorphOne;
use Sfneal\Address\Models\Address;


/**
 * Address relationship.
 *
 * @return MorphOne|Address
 */
public function address()
{
    return $this->morphOne(Address::class, 'addressable');
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email stephen.neal14@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate.