PHPackages                             trexology/contactable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. trexology/contactable

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

trexology/contactable
=====================

Allows users to have multiple e-mail addresses and phone numbers, and log in with them, on Laravel

1.0.1(7y ago)1362PHP

Since Aug 17Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Trexology/contactable)[ Packagist](https://packagist.org/packages/trexology/contactable)[ RSS](/packages/trexology-contactable/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (12)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/1239590c4892be12391439ace135889509f491da7cbbc06cc9b12f5f527ebd44/68747470733a2f2f706f7365722e707567782e6f72672f747265786f6c6f67792f636f6e7461637461626c652f762f737461626c65)](https://packagist.org/packages/trexology/contactable)[![Total Downloads](https://camo.githubusercontent.com/c45e53e1e0fbe97a94cd53a3645f9143359eba1dda52d2c561b1b03221055612/68747470733a2f2f706f7365722e707567782e6f72672f747265786f6c6f67792f636f6e7461637461626c652f646f776e6c6f616473)](https://packagist.org/packages/trexology/contactable)[![Latest Unstable Version](https://camo.githubusercontent.com/2c3caadd5ea01d8e10964f1f88d54c19a679ca0c0ad9cad81b9cbb57c67e941b/68747470733a2f2f706f7365722e707567782e6f72672f747265786f6c6f67792f636f6e7461637461626c652f762f756e737461626c65)](https://packagist.org/packages/trexology/contactable) [![License](https://camo.githubusercontent.com/ffafc007e0e4ae999e5f368e3f9104048efc5e9eabe941c1e6d84277fbe02e4f/68747470733a2f2f706f7365722e707567782e6f72672f747265786f6c6f67792f636f6e7461637461626c652f6c6963656e7365)](https://packagist.org/packages/trexology/contactable)

Contactable
===========

[](#contactable)

A [Laravel 5.2+](http://laravel.com/docs/5.2) package designed to enhance Eloquent users (or any other model) with relations to multiple e-mail addresses and addresses, additionally allowing users to login with any of the above.

```
composer require trexology/contactable
```

And then include the service provider within `app/config/app.php`. (not required for laravel 5.5+)

```
'providers' => [
    Trexology\Contactable\PointableServiceProvider::class
];
```

At last you need to publish and run the migration.

```
php artisan vendor:publish --provider="Trexology\Contactable\Providers\ContactableServiceProvider" && php artisan migrate

```

This will add addresses, email\_addresses and phone\_numbers tables to your database.

Remove the email column from your create\_users\_table table migration, if applicable.

Usage
-----

[](#usage)

For any models you would like to have their own addresses or e-mail addresses, add the appropriate trait:

```
use Trexology\Contactable\Traits\Addressable;
use Trexology\Contactable\Traits\Phonable;
use Trexology\Contactable\Traits\Emailable;

class User extends Authenticatable implements
{
    use Addressable, Phonable, Emailable;

```

…or use the `Contactable` trait to quickly add addresses, phones and e-mails:

```
use Trexology\Contactable\Traits\Contactable;

class User extends Authenticatable implements
{
    use Contactable;

```

The above traits simply add the appropriate relationships to your model. Now, you may query the relationships using Eloquent as you normally would.

**E-mail addresses** are accessed via the “emails()” method (a MorphMany relationship):

```
