1. Go to this page and download the library: Download chuckcms/laravel-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/ */
chuckcms / laravel-contacts example snippets
namespace App\Models;
use Chuckcms\Contacts\Traits\HasContacts;
use Illuminate\Database\Eloquent\Model;
class Company extends Model
{
use HasContacts;
// ...
}
$company = Company::first();
$company->addContact([
'first_name' => 'John', // / defaults to: null
'email' => '[email protected]', // defaults to: null
'is_public' => true, // defaults to: false
'is_primary' => true, // defaults to: false
]);
use Chuckcms\Contacts\Models\Contact;
$contact = Contact::first();
$company = Company::first();
$company->assignContact($contact);