1. Go to this page and download the library: Download inmanturbo/contacts library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
inmanturbo / contacts example snippets
//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