本文整理汇总了PHP中app\models\Contact类的典型用法代码示例。如果您正苦于以下问题:PHP Contact类的具体用法?PHP Contact怎么用?PHP Contact使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Contact类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate($type)
{
$incoming = new Incoming();
$contact = new Contact();
if ($incoming->load(Yii::$app->request->post()) && $contact->load(Yii::$app->request->post())) {
$contact->type = Contact::PERSON;
$isValid = $incoming->validate();
$isValid = $contact->validate() && $isValid;
if ($isValid) {
$incoming->save(false);
$contact->save(false);
$from = new Endpoint();
$from->type = Endpoint::FROM;
$from->doc_id = $incoming->id;
$from->contact_id = $contact->id;
$from->save(false);
return $this->redirect(['index']);
} else {
Yii::trace($contact->errors);
}
}
$incoming->type = Incoming::PERSON;
$incoming->docdate = date('Y-m-d');
return $this->render('create', ['incoming' => $incoming, 'contact' => $contact]);
}
示例2: actionIndex
public function actionIndex()
{
$phone = Yii::$app->request->get('phone');
$email = Yii::$app->request->get('email');
$contact = new Contact();
$contact->setEmail($email);
$contact->setPhone($phone);
return $this->render('index', ["contact" => $contact]);
}
示例3: actionContact
public function actionContact()
{
/*$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('contactFormSubmitted');
return $this->refresh();
} else {
return $this->render('contact', [
'model' => $model,
]);
}*/
if (isset($_POST['nombre']) && isset($_POST['apellido']) && isset($_POST['email']) && isset($_POST['celular']) && isset($_POST['tipo']) && isset($_POST['mensaje'])) {
$contact = new Contact();
$contact->type = $_POST['tipo'];
$contact->name = $_POST['nombre'];
$contact->lastname = $_POST['apellido'];
$contact->email = $_POST['email'];
$contact->cellphone = $_POST['celular'];
$contact->message = $_POST['mensaje'];
if ($contact->type == 'Reclamo') {
if (isset($_POST['cedula'])) {
$contact->identity = $_POST['cedula'];
} else {
echo "no cedula";
}
}
if ($contact->save()) {
/*$body='Tipo: '.$contact->type.'\n';
if($contact->identity!=''){
$body.='Cedula: '.$contact->identity;
}
$body.='Nombre: '.$contact->name.'\n'.
'Apellido: '.$contact->lastname.'\n'.
'Email: '.$contact->lastname.'\n'.
'Cellphone: '.$contact->cellphone.'\n'.
'Mensaje: '.$contact->message.'\n';*/
if (Yii::$app->mailer->compose('contact/contact', ['contact' => $contact])->setFrom([Yii::$app->params['adminEmail'] => 'Optica los Andes'])->setTo('1800optica@ola.ec')->setSubject('Contacto Optica los Andes')->send()) {
echo "enviado";
} else {
echo "no enviado";
}
} else {
echo "no save";
print_r($contact->getErrors());
}
} else {
echo "no post";
}
}
示例4: getData
private function getData($request)
{
$account = Auth::user()->account;
$data = ['account' => $account, 'title' => 'Invoice Ninja v' . NINJA_VERSION . ' - ' . $account->formatDateTime($account->getDateTime()), 'multiUser' => $account->users->count() > 1];
if ($request->input(ENTITY_CLIENT)) {
$data['clients'] = Client::scope()->with('user', 'contacts', 'country')->withArchived()->get();
$data['contacts'] = Contact::scope()->with('user', 'client.contacts')->withTrashed()->get();
$data['credits'] = Credit::scope()->with('user', 'client.contacts')->get();
}
if ($request->input(ENTITY_TASK)) {
$data['tasks'] = Task::scope()->with('user', 'client.contacts')->withArchived()->get();
}
if ($request->input(ENTITY_INVOICE)) {
$data['invoices'] = Invoice::scope()->with('user', 'client.contacts', 'invoice_status')->withArchived()->where('is_quote', '=', false)->where('is_recurring', '=', false)->get();
$data['quotes'] = Invoice::scope()->with('user', 'client.contacts', 'invoice_status')->withArchived()->where('is_quote', '=', true)->where('is_recurring', '=', false)->get();
$data['recurringInvoices'] = Invoice::scope()->with('user', 'client.contacts', 'invoice_status', 'frequency')->withArchived()->where('is_quote', '=', false)->where('is_recurring', '=', true)->get();
}
if ($request->input(ENTITY_PAYMENT)) {
$data['payments'] = Payment::scope()->withArchived()->with('user', 'client.contacts', 'payment_type', 'invoice', 'account_gateway.gateway')->get();
}
if ($request->input(ENTITY_VENDOR)) {
$data['clients'] = Vendor::scope()->with('user', 'vendorcontacts', 'country')->withArchived()->get();
$data['vendor_contacts'] = VendorContact::scope()->with('user', 'vendor.contacts')->withTrashed()->get();
/*
$data['expenses'] = Credit::scope()
->with('user', 'client.contacts')
->get();
*/
}
return $data;
}
示例5: delete
public function delete($id)
{
if (Contact::destroy($id)) {
return redirect()->back()->with('msg', 'Контакт удален');
}
return redirect()->back()->with('warning', 'Не удалось удалить');
}
示例6: postImport
/**
* post Import
*
* @param Business $business Business to import Contacts to
* @param Request $request Submitted form data
* @return Response Redirect to Business addressbook
*/
public function postImport(Business $business, Request $request)
{
$this->log->info(__METHOD__);
$this->log->info(sprintf(" businessId:%s", $business->id));
//////////////////
// FOR REFACTOR //
//////////////////
$csv = $this->csvToArray(Request::get('data'));
foreach ($csv as $import) {
$import = array_map(function ($item) {
return $item == 'NULL' ? null : $item;
}, $import);
if ($import['birthdate'] !== null) {
$date = \DateTime::createFromFormat('Ymd', $import['birthdate']);
$import['birthdate'] = $date->format('m/d/Y');
}
$notes = $import['notes'];
unset($import['notes']);
$contact = Contact::create($import);
$business->contacts()->attach($contact, ['notes' => $notes]);
$business->save();
}
$count = count($csv);
$this->log->info(" Imported {$count} contacts");
Notifynder::category('user.importedContacts')->from('App\\Models\\User', auth()->user()->id)->to('App\\Models\\Business', $business->id)->url('http://localhost')->extra(compact('count'))->send();
Flash::success(trans('manager.contacts.msg.import.success'));
return redirect()->route('manager.business.contact.index', [$business]);
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$lipsum = new LoremIpsumGenerator();
Role::create(['title' => 'Administrator', 'slug' => 'admin']);
Role::create(['title' => 'Redactor', 'slug' => 'redac']);
Role::create(['title' => 'User', 'slug' => 'user']);
User::create(['username' => 'GreatAdmin', 'email' => 'fathir.irhas@outlook.com', 'password' => bcrypt('admin'), 'seen' => true, 'role_id' => 1, 'confirmed' => true]);
User::create(['username' => 'GreatRedactor', 'email' => 'fatheer.eerhas@gmail.com', 'password' => bcrypt('redac'), 'seen' => true, 'role_id' => 2, 'valid' => true, 'confirmed' => true]);
User::create(['username' => 'Walker', 'email' => 'fathir139@yahoo.co.id', 'password' => bcrypt('walker'), 'role_id' => 3, 'confirmed' => true]);
User::create(['username' => 'Slacker', 'email' => 'slacker@la.fr', 'password' => bcrypt('slacker'), 'role_id' => 3, 'confirmed' => true]);
Contact::create(['name' => 'Dupont', 'email' => 'dupont@la.fr', 'text' => 'Lorem ipsum inceptos malesuada leo fusce tortor sociosqu semper, facilisis semper class tempus faucibus tristique duis eros, cubilia quisque habitasse aliquam fringilla orci non. Vel laoreet dolor enim justo facilisis neque accumsan, in ad venenatis hac per dictumst nulla ligula, donec mollis massa porttitor ullamcorper risus. Eu platea fringilla, habitasse.']);
Contact::create(['name' => 'Durand', 'email' => 'durand@la.fr', 'text' => ' Lorem ipsum erat non elit ultrices placerat, netus metus feugiat non conubia fusce porttitor, sociosqu diam commodo metus in. Himenaeos vitae aptent consequat luctus purus eleifend enim, sollicitudin eleifend porta malesuada ac class conubia, condimentum mauris facilisis conubia quis scelerisque. Lacinia tempus nullam felis fusce ac potenti netus ornare semper molestie, iaculis fermentum ornare curabitur tincidunt imperdiet scelerisque imperdiet euismod.']);
Contact::create(['name' => 'Martin', 'email' => 'martin@la.fr', 'text' => 'Lorem ipsum tempor netus aenean ligula habitant vehicula tempor ultrices, placerat sociosqu ultrices consectetur ullamcorper tincidunt quisque tellus, ante nostra euismod nec suspendisse sem curabitur elit. Malesuada lacus viverra sagittis sit ornare orci, augue nullam adipiscing pulvinar libero aliquam vestibulum, platea cursus pellentesque leo dui. Lectus curabitur euismod ad, erat.', 'seen' => true]);
Tag::create(['tag' => 'Tag1']);
Tag::create(['tag' => 'Tag2']);
Tag::create(['tag' => 'Tag3']);
Tag::create(['tag' => 'Tag4']);
Post::create(['title' => 'Post 1', 'slug' => 'post-1', 'summary' => '<img alt="" src="/filemanager/userfiles/user2/mega-champignon.png" style="float:left; height:128px; width:128px" />' . $lipsum->getContent(50), 'content' => $lipsum->getContent(500), 'active' => true, 'user_id' => 1]);
Post::create(['title' => 'Post 2', 'slug' => 'post-2', 'summary' => '<img alt="" src="/filemanager/userfiles/user2/goomba.png" style="float:left; height:128px; width:128px" />' . $lipsum->getContent(50), 'content' => '<p>Lorem ipsum convallis ac curae non elit ultrices placerat netus metus feugiat, non conubia fusce porttitor sociosqu diam commodo metus in himenaeos, vitae aptent consequat luctus purus eleifend enim sollicitudin eleifend porta. Malesuada ac class conubia condimentum mauris facilisis conubia quis scelerisque lacinia, tempus nullam felis fusce ac potenti netus ornare semper. Molestie iaculis fermentum ornare curabitur tincidunt imperdiet scelerisque, imperdiet euismod scelerisque torquent curae rhoncus, sollicitudin tortor placerat aptent hac nec. Posuere suscipit sed tortor neque urna hendrerit vehicula duis litora tristique congue nec auctor felis libero, ornare habitasse nec elit felis inceptos tellus inceptos cubilia quis mattis faucibus sem non.</p>
<p>Odio fringilla class aliquam metus ipsum lorem luctus pharetra dictum, vehicula tempus in venenatis gravida ut gravida proin orci, quis sed platea mi quisque hendrerit semper hendrerit. Facilisis ante sapien faucibus ligula commodo vestibulum rutrum pretium, varius sem aliquet himenaeos dolor cursus nunc habitasse, aliquam ut curabitur ipsum luctus ut rutrum. Odio condimentum donec suscipit molestie est etiam sit rutrum dui nostra, sem aliquet conubia nullam sollicitudin rhoncus venenatis vivamus rhoncus netus, risus tortor non mauris turpis eget integer nibh dolor. Commodo venenatis ut molestie semper adipiscing amet cras, class donec sapien malesuada auctor sapien arcu inceptos, aenean consequat metus litora mattis vivamus.</p>
<pre>
<code class="language-php">protected function getUserByRecaller($recaller)
{
if ($this->validRecaller($recaller) && ! $this->tokenRetrievalAttempted)
{
$this->tokenRetrievalAttempted = true;
list($id, $token) = explode("|", $recaller, 2);
$this->viaRemember = ! is_null($user = $this->provider->retrieveByToken($id, $token));
return $user;
}
}</code></pre>
<p>Feugiat arcu adipiscing mauris primis ante ullamcorper ad nisi, lobortis arcu per orci malesuada blandit metus tortor, urna turpis consectetur porttitor egestas sed eleifend. Eget tincidunt pharetra varius tincidunt morbi malesuada elementum mi torquent mollis, eu lobortis curae purus amet vivamus amet nulla torquent, nibh eu diam aliquam pretium donec aliquam tempus lacus. Tempus feugiat lectus cras non velit mollis sit et integer, egestas habitant auctor integer sem at nam massa himenaeos, netus vel dapibus nibh malesuada leo fusce tortor. Sociosqu semper facilisis semper class tempus faucibus tristique duis eros, cubilia quisque habitasse aliquam fringilla orci non vel, laoreet dolor enim justo facilisis neque accumsan in.</p>
<p>Ad venenatis hac per dictumst nulla ligula donec, mollis massa porttitor ullamcorper risus eu platea, fringilla habitasse suscipit pellentesque donec est. Habitant vehicula tempor ultrices placerat sociosqu ultrices consectetur ullamcorper tincidunt quisque tellus, ante nostra euismod nec suspendisse sem curabitur elit malesuada lacus. Viverra sagittis sit ornare orci augue nullam adipiscing pulvinar libero aliquam vestibulum platea cursus pellentesque leo dui lectus, curabitur euismod ad erat curae non elit ultrices placerat netus metus feugiat non conubia fusce porttitor. Sociosqu diam commodo metus in himenaeos vitae aptent consequat luctus purus eleifend enim sollicitudin eleifend, porta malesuada ac class conubia condimentum mauris facilisis conubia quis scelerisque lacinia.</p>
<p>Tempus nullam felis fusce ac potenti netus ornare semper molestie iaculis, fermentum ornare curabitur tincidunt imperdiet scelerisque imperdiet euismod. Scelerisque torquent curae rhoncus sollicitudin tortor placerat aptent hac, nec posuere suscipit sed tortor neque urna hendrerit, vehicula duis litora tristique congue nec auctor. Felis libero ornare habitasse nec elit felis, inceptos tellus inceptos cubilia quis mattis, faucibus sem non odio fringilla. Class aliquam metus ipsum lorem luctus pharetra dictum vehicula, tempus in venenatis gravida ut gravida proin orci, quis sed platea mi quisque hendrerit semper.</p>
', 'active' => true, 'user_id' => 2]);
Post::create(['title' => 'Post 3', 'slug' => 'post-3', 'summary' => '<img alt="" src="/filemanager/userfiles/user2/rouge-shell.png" style="float:left; height:128px; width:128px" />' . $lipsum->getContent(50), 'content' => $lipsum->getContent(500), 'active' => true, 'user_id' => 2]);
Post::create(['title' => 'Post 4', 'slug' => 'post-4', 'summary' => '<img alt="" src="/filemanager/userfiles/user2/rouge-shyguy.png" style="float:left; height:128px; width:128px" />' . $lipsum->getContent(50), 'content' => $lipsum->getContent(500), 'active' => true, 'user_id' => 2]);
PostTag::create(['post_id' => 1, 'tag_id' => 1]);
PostTag::create(['post_id' => 1, 'tag_id' => 2]);
PostTag::create(['post_id' => 2, 'tag_id' => 1]);
PostTag::create(['post_id' => 2, 'tag_id' => 2]);
PostTag::create(['post_id' => 2, 'tag_id' => 3]);
PostTag::create(['post_id' => 3, 'tag_id' => 1]);
PostTag::create(['post_id' => 3, 'tag_id' => 2]);
PostTag::create(['post_id' => 3, 'tag_id' => 4]);
Comment::create(['content' => $lipsum->getContent(200), 'user_id' => 2, 'post_id' => 1]);
Comment::create(['content' => $lipsum->getContent(200), 'user_id' => 2, 'post_id' => 2]);
Comment::create(['content' => $lipsum->getContent(200), 'user_id' => 3, 'post_id' => 1]);
}
示例8: postContact
public function postContact(Request $request)
{
$this->validate($request, ['name' => 'required|min:3', 'email' => 'required|email', 'content' => 'required|min:10']);
\DB::transaction(function () use($request) {
Contact::create($request->all());
});
session()->flash('message', ['success', 'Thanks for contacting us, we\'ve received your request, be with you soon!']);
return redirect('/');
}
示例9: getDelete
public function getDelete($id)
{
$table = null;
if (!empty($id)) {
$table = Contact::whereId($id)->whereCustomerId(Auth::customer()->user()->id);
$table->delete();
}
return response()->json(array('msg' => 'ok', 'state' => 1, 'data' => null));
}
示例10: homepage
public function homepage()
{
$params = array('logo' => Title::findOrFail(1), 'timer' => Timer::findOrFail(1), 'about' => About::findOrFail(1), 'contacts' => Contact::where('enabled', '=', true)->orderBy('id', 'ASC')->get(), 'grouped' => GroupRepository::grouped(), 'offices' => Office::where('enabled', '=', true)->orderBy('position', 'ASC')->get(), 'title' => 'TWIGA – крупнейшая независимая коммуникационная группа в России и странах СНГ');
/*if (Request::has('r')) {
$r = Request::get('r');
Session::set('r', $r);
return redirect('/#' . $r);
}*/
$view = Agent::isTablet() || Request::has('t') ? 'tablet.homepage' : (Agent::isMobile() || Request::has('m') ? 'mobile.homepage' : 'index.homepage');
return view($view, $params);
}
示例11: run
public function run($id = null)
{
if ($id == null) {
$searchModel = new ContactSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->controller->render('contact', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
} else {
$model = Contact::findOne($id);
$model->status = 1;
$model->save();
return $this->controller->render('_contact', ['model' => $model]);
}
}
示例12: actionIndex
public function actionIndex()
{
$model = new Contact();
$msgs = Contact::find()->orderBy('id DESC')->limit('50')->all();
if ($model->load(Yii::$app->request->post())) {
$model->admin_id = Yii::$app->user->id;
$model->time = time();
$model->save();
$this->redirect('contact');
}
// проверка на время публикации (1 час)
$openContactForm = true;
$restTime = 0;
foreach ($msgs as $one) {
if ($one['admin_id'] == Yii::$app->user->id && $one['time'] >= time() - 60 * 60) {
$openContactForm = false;
$restTime = ceil(($one['time'] - (time() - 60 * 60)) / 60);
break;
}
}
return $this->render('index', ['model' => $model, 'msgs' => $msgs, 'openContactForm' => $openContactForm, 'restTime' => $restTime]);
}
示例13: getCredentials
/**
* Get the needed authorization credentials from the request.
*
* @param \Illuminate\Http\Request $request
*
* @return array
*/
protected function getCredentials(Request $request)
{
$credentials = $request->only('password');
$credentials['id'] = null;
$contactKey = session('contact_key');
if ($contactKey) {
$contact = Contact::where('contact_key', '=', $contactKey)->first();
if ($contact && !$contact->is_deleted) {
$credentials['id'] = $contact->id;
}
}
return $credentials;
}
示例14: run
public function run()
{
$this->command->info('Running UserTableSeeder');
Eloquent::unguard();
$faker = Faker\Factory::create();
$company = Company::create();
$account = Account::create(['name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => Country::all()->random()->id, 'account_key' => str_random(RANDOM_KEY_LENGTH), 'invoice_terms' => $faker->text($faker->numberBetween(50, 300)), 'work_phone' => $faker->phoneNumber, 'work_email' => $faker->safeEmail, 'invoice_design_id' => InvoiceDesign::where('id', '<', CUSTOM_DESIGN)->get()->random()->id, 'header_font_id' => min(Font::all()->random()->id, 17), 'body_font_id' => min(Font::all()->random()->id, 17), 'primary_color' => $faker->hexcolor, 'timezone_id' => 1, 'company_id' => $company->id]);
$user = User::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true, 'notify_sent' => false, 'notify_paid' => false, 'is_admin' => 1]);
$client = Client::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => DEFAULT_COUNTRY, 'currency_id' => DEFAULT_CURRENCY]);
Contact::create(['user_id' => $user->id, 'account_id' => $account->id, 'client_id' => $client->id, 'public_id' => 1, 'email' => env('TEST_EMAIL', TEST_USERNAME), 'is_primary' => true]);
Product::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'product_key' => 'ITEM', 'notes' => 'Something nice...', 'cost' => 10]);
Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]);
}
示例15: addContact
public function addContact($data, $isPrimary = false)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
if ($publicId && $publicId != '-1') {
$contact = Contact::scope($publicId)->firstOrFail();
} else {
$contact = Contact::createNew();
$contact->send_invoice = true;
}
$contact->fill($data);
$contact->is_primary = $isPrimary;
return $this->contacts()->save($contact);
}