本文整理汇总了PHP中Contact::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::create方法的具体用法?PHP Contact::create怎么用?PHP Contact::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addcontact
function addcontact($_post)
{
$user->id = $this->getuser();
$profile = new Contact($user->id);
$result = $profile->create($_post);
return $result;
}
示例2: postNewAdmin
public function postNewAdmin()
{
//verify the user input and create account
$validator = Validator::make(Input::all(), array('Identity_No' => 'required', 'Email' => 'required|email', 'Phone_Number' => 'required', 'First_Name' => 'required', 'Last_Name' => 'required', 'Photo_1' => 'image|required', 'Photo_2' => 'image|required', 'Photo_3' => 'image|required'));
if ($validator->fails()) {
return Redirect::route('super-admin-new-admin-get')->withErrors($validator)->withInput()->with('globalerror', 'Sorry!! The Data was not Saved, please retry');
} else {
$identitynumber = Input::get('Identity_No');
$email = Input::get('Email');
$phonenumber = Input::get('Phone Numer');
$firstname = Input::get('First_Name');
$lastname = Input::get('Last_Name');
$photo_1 = Input::file('Photo_1');
$photo_2 = Input::file('Photo_2');
$photo_3 = Input::file('Photo_3');
//register the new user
$newuser = User::create(array('Identity_No' => $identitynumber, 'First_Name' => $firstname, 'Last_Name' => $lastname, 'Password' => Hash::make($identitynumber), 'Active' => TRUE));
//register the new user contact
$newcontact = Contact::create(array('Email' => $email, 'Phone_Number' => $phonenumber));
//Save the three Photos
$photo1 = $this->postPhoto($photo_1);
$photo2 = $this->postPhoto($photo_2);
$photo3 = $this->postPhoto($photo_3);
$newphotos = Photo::create(array('photo_1' => $photo1, 'photo_2' => $photo2, 'photo_3' => $photo3));
//save the details to the students table
$newadmin = Admin::create(array('Users_Id' => $newuser->id, 'Contacts_Id' => $newcontact->id, 'Photos_Id' => $newphotos->id));
if ($newuser && $newcontact && $newphotos && $newadmin) {
return Redirect::route('super-admin-new-admin-get')->with('globalsuccess', 'New Admin Details Have been Added');
}
}
}
开发者ID:franqq,项目名称:Secure-Evoting-With-Face-Recognition,代码行数:31,代码来源:SuperAdminNavigationController.php
示例3: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Contact::create([]);
}
}
示例4: setUp
function setUp()
{
parent::setUp();
$students = 'indivi_student' . substr(sha1(rand()), 0, 7);
$params = array('label' => $students, 'name' => $students, 'parent_id' => 1, 'is_active' => 1);
$result = CRM_Contact_BAO_ContactType::add($params);
$this->student = $params['name'];
$parents = 'indivi_parent' . substr(sha1(rand()), 0, 7);
$params = array('label' => $parents, 'name' => $parents, 'parent_id' => 1, 'is_active' => 1);
$result = CRM_Contact_BAO_ContactType::add($params);
$this->parent = $params['name'];
$orgs = 'org_sponsor' . substr(sha1(rand()), 0, 7);
$params = array('label' => $orgs, 'name' => $orgs, 'parent_id' => 3, 'is_active' => 1);
$result = CRM_Contact_BAO_ContactType::add($params);
$this->sponsor = $params['name'];
$this->indiviParams = array('first_name' => 'Anne', 'last_name' => 'Grant', 'contact_type' => 'Individual');
$this->individual = Contact::create($this->indiviParams);
$this->indiviStudentParams = array('first_name' => 'Bill', 'last_name' => 'Adams', 'contact_type' => 'Individual', 'contact_sub_type' => $this->student);
$this->indiviStudent = Contact::create($this->indiviStudentParams);
$this->indiviParentParams = array('first_name' => 'Alen', 'last_name' => 'Adams', 'contact_type' => 'Individual', 'contact_sub_type' => $this->parent);
$this->indiviParent = Contact::create($this->indiviParentParams);
$this->organizationParams = array('organization_name' => 'Compumentor', 'contact_type' => 'Organization');
$this->organization = Contact::create($this->organizationParams);
$this->orgSponsorParams = array('organization_name' => 'Conservation Corp', 'contact_type' => 'Organization', 'contact_sub_type' => $this->sponsor);
$this->orgSponsor = Contact::create($this->orgSponsorParams);
$this->householdParams = array('household_name' => "John Doe's home", 'contact_type' => 'Household');
$this->household = Contact::create($this->householdParams);
}
示例5: setUp
public function setUp()
{
parent::setUp();
//create contact subtypes
$params = array('label' => 'indivi_student', 'name' => 'indivi_student', 'parent_id' => 1, 'is_active' => 1);
$result = CRM_Contact_BAO_ContactType::add($params);
$this->student = $params['name'];
$params = array('label' => 'indivi_parent', 'name' => 'indivi_parent', 'parent_id' => 1, 'is_active' => 1);
$result = CRM_Contact_BAO_ContactType::add($params);
$this->parent = $params['name'];
$params = array('label' => 'org_sponsor', 'name' => 'org_sponsor', 'parent_id' => 3, 'is_active' => 1);
$result = CRM_Contact_BAO_ContactType::add($params);
$this->sponsor = $params['name'];
//create contacts
$params = array('first_name' => 'Anne', 'last_name' => 'Grant', 'contact_type' => 'Individual');
$this->individual = Contact::create($params);
$params = array('first_name' => 'Bill', 'last_name' => 'Adams', 'contact_type' => 'Individual', 'contact_sub_type' => $this->student);
$this->indivi_student = Contact::create($params);
$params = array('first_name' => 'Alen', 'last_name' => 'Adams', 'contact_type' => 'Individual', 'contact_sub_type' => $this->parent);
$this->indivi_parent = Contact::create($params);
$params = array('organization_name' => 'Compumentor', 'contact_type' => 'Organization');
$this->organization = Contact::create($params);
$params = array('organization_name' => 'Conservation Corp', 'contact_type' => 'Organization', 'contact_sub_type' => $this->sponsor);
$this->organization_sponsor = Contact::create($params);
}
示例6: run
public function run()
{
Contact::truncate();
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Contact::create(["name" => $faker->name, "email" => $faker->email, "phone" => $faker->phoneNumber]);
}
}
示例7: run
public function run()
{
Contact::create(['description' => 'Công ty Cổ phần truyền thông ABC
Địa chỉ: P501, Tầng 5, Tòa nhà văn phòng, Số 5B/55, Huỳnh Thúc Kháng, Phường Láng Hạ, Quận Đống Đa, Hà Nội
Tel: (84-4) 3.775.4334 - Fax: (84-4) 3512 1804', 'slug' => 'lien-he']);
Contact::create(['description' => 'ABC company
Địa chỉ: P501, Tầng 5, Tòa nhà văn phòng, Số 5B/55, Huỳnh Thúc Kháng, Phường Láng Hạ, Quận Đống Đa, Hà Nội
Tel: (84-4) 3.775.4334 - Fax: (84-4) 3512 1804', 'slug' => 'contact']);
}
示例8: create
function create()
{
if (Input::exist()) {
$data = Input::parse();
$contact = Contact::create($data);
$contact->save();
echo json_encode($contact);
}
}
示例9: HandleForm
/**
* @param array $data
* @param Form $form
* @throws ValidationException
* @throws null
*/
public function HandleForm($data, $form)
{
/** @var Contact $Contact */
$Contact = Contact::create();
$form->saveInto($Contact);
$Contact->write();
Session::set('ThanksMessage', true);
$this->redirect($this->Link() . '#section-contact');
}
示例10: run
public function run()
{
$faker = Faker::create();
for ($i = 0; $i < 10; $i++) {
Contact::create(array('user_id' => 2, 'full_name' => $faker->firstName, 'email' => $faker->email, 'last_follow_up' => date('Y-m-d H:i:s'), 'email_sent' => "", 'active' => 1, 'isAutomaticFollowUp' => 1, 'phone_number' => $faker->phoneNumber));
}
for ($i = 0; $i < 10; $i++) {
Contact::create(array('user_id' => 3, 'full_name' => $faker->firstName, 'email' => $faker->email, 'last_follow_up' => date('Y-m-d H:i:s'), 'email_sent' => "", 'active' => 1, 'isAutomaticFollowUp' => 1, 'phone_number' => $faker->phoneNumber));
}
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::json();
Contact::create(['name' => $input->get('name'), 'surname' => $input->get("surname"), 'phone' => $input->get("phone"), 'email' => $input->get("email"), 'description' => $input->get('description')]);
$query = Contact::select('id')->where("email", '=', $input->get('email'))->first();
$id = $query->id;
Session::put('id', $id);
$returnArray = array('id' => $id, 'name' => $input->get('name'), 'surname' => $input->get('surname'), 'phone' => $input->get('phone'), 'email' => $input->get('email'), 'description' => $input->get('description'));
return $returnArray;
}
示例12: crearContacto
/**
* Crear el contacto nuevo
*/
public function crearContacto()
{
$rules = array('nombre' => 'required|max:250', 'apellido' => 'required|max:250');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('/admin/contacts/add')->withInput()->withErrors($validator);
} else {
Contact::create(Input::all());
return Redirect::route('contacts.list');
}
}
示例13: run
public function run()
{
$faker = Faker::create();
$files = \Symfony\Component\Finder\Finder::create()->files()->in(public_path('images/contacts/seeds'));
$photos = [];
foreach ($files as $file) {
$photos[] = 'seeds/' . $file->getFilename();
}
foreach (range(1, 30) as $index) {
Contact::create(['firstName' => $faker->firstName, 'lastName' => $faker->lastName, 'birthday' => $faker->dateTimeThisCentury, 'phone' => $faker->phoneNumber, 'address' => $faker->address, 'country_id' => Country::random()->id, 'comment' => $faker->paragraph(5), 'photo' => $faker->randomElement($photos)]);
}
}
示例14: run
public function run()
{
// clear out the database on subsequent seeding attempts
DB::table('contacts')->truncate();
$faker = Faker::create();
// add a known record
Contact::create(['firstName' => 'Eric', 'lastName' => 'Jones', 'birthday' => date('Y-m-d'), 'street1' => '1 Monument Circle', 'city' => 'Indianapolis', 'state' => 'IN', 'zip' => '46204', 'email' => 'eric@example.com', 'phone' => '(555) 123-4444']);
// add 99 random records
foreach (range(1, 99) as $index) {
Contact::create(['firstName' => $faker->firstName, 'lastName' => $faker->lastName, 'birthday' => $faker->date, 'street1' => $faker->streetAddress, 'street2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'zip' => $faker->postcode, 'email' => $faker->email, 'phone' => $faker->phoneNumber]);
}
}
示例15: post
/**
* Create contact object
*
* @param array $request_data Request datas
* @return int ID of contact
*
* @url POST contact/
*/
function post($request_data = NULL)
{
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
foreach ($request_data as $field => $value) {
$this->contact->{$field} = $value;
}
return $this->contact->create(DolibarrApiAccess::$user);
}