PHP code example of jn-devops / contacts
1. Go to this page and download the library: Download jn-devops/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/ */
jn-devops / contacts example snippets
use Homeful\Contacts\Models\Contact;
$contact = Contact::create([
'first_name' => 'Juan',
'last_name' => 'Dela Cruz',
'email' => '[email protected] ',
'mobile' => '09171234567',
'date_of_birth' => '1990-05-15',
]);
use Homeful\Contacts\Models\Customer;
$customer = Customer::create([
'first_name' => 'Maria',
'last_name' => 'Santos',
'email' => '[email protected] ',
'mobile' => '09181234567',
]);
$customer->employment = [
[
'type' => 'Primary',
'monthly_gross_income' => 50000,
'employment_status' => 'Regular',
'employer' => [
"name" => "Tech Solutions Inc.",
"email" => "[email protected] ",
"address" => [
"type" => "Primary",
"region" => "NCR",
"country" => "PH",
"address1" => "123 Makati Avenue, Makati City",
"postal_code" => "1200"
],
"industry" => "Technology",
]
]
];
$customer->save();
$customer->addMediaFromUrl('https://example.com/uploads/id_image.jpg')->toMediaCollection('id-images');
$customer->addMediaFromUrl('https://example.com/uploads/contract.pdf')->toMediaCollection('contract-documents');
use Homeful\Contacts\Classes\ContactMetaData;
$contactMetadata = ContactMetaData::from($customer->toArray());