Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inmanturbo/contacts
https://github.com/inmanturbo/contacts
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/inmanturbo/contacts
- Owner: inmanturbo
- License: mit
- Created: 2024-01-27T20:37:41.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-02T08:03:25.000Z (9 months ago)
- Last Synced: 2024-04-03T12:44:54.832Z (7 months ago)
- Language: PHP
- Size: 84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Laravel Contacts Manager
A simple utility package to handle contacts lists in Laravel
## Installation
You can install the package via composer:
```bash
composer require inmanturbo/laravel-contacts-manager
```You can publish and run the migrations with:
```bash
php artisan vendor:publish --tag="contacts-manager-migrations"
php artisan migrate
```## Usage
```php
//Create a contact
Contact::create([
'first_name' => '...',
'last_name' => '...',
'business_name' => '...',
'address' => '...',
'zip_code' => '...',
'country_code' => '...',
'email' => '...',
'mobile' => '...',
'phone' => '...',
'vat_number' => '...',
'notes' => '...',
'type' => '...' // MANDATORY: 'private' or 'business',
]);//Create a contact list
ContactList::create([
'user_id' => '1' //desired user id
'name' => 'this is the list name'
]);//attach a contact to a list and viceversa
$contact->lists()->attach($listId);
$list->contacts()->attach($contactId);//fetch contacts from a list
$list->contacts;
//fetch all lists connected to a contact
$contact->lists;
//Contact and ContactList are taggable. Feel free to use tags as you desire in your flow
//Tags are meant to be a flexible way to categorize your model.
$tag = Tag::create(['name' => 'Test tag', 'user_id' => $user->id]);$contact->tags()->attach($tag->id);
$contactList->tags()->attach($tag->id);
//Retrive taggable elements from a tag
$tag->contacts; //returns a collection of Contacts
$tag->contactLists; //returns a collection of ContactList
```## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Filippo Calabrese](https://github.com/filippocalabrese)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.