当前位置: 首页>>代码示例>>PHP>>正文


PHP Contact::create方法代码示例

本文整理汇总了PHP中app\Contact::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::create方法的具体用法?PHP Contact::create怎么用?PHP Contact::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Contact的用法示例。


在下文中一共展示了Contact::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, Contact::$rules);
     $input = Input::all();
     Contact::create($input);
     return Redirect::route('contact.index')->with('message', 'Correo creado correctamente');
 }
开发者ID:Raul-MA,项目名称:ArtistSystem,代码行数:13,代码来源:ContactController.php

示例2: store

 /**
  * store Contact
  *
  * @param  Business            $business Business that holds the Contact
  * @param  AlterContactRequest $request  Alter Contact Request
  * @return Response                      View for created Contact
  *                                       or Redirect
  */
 public function store(Business $business, AlterContactRequest $request)
 {
     $this->log->info('BusinessContactController: store');
     $business_name = $business->name;
     Notifynder::category('user.subscribedBusiness')->from('App\\User', auth()->user()->id)->to('App\\Business', $business->id)->url('http://localhost')->extra(compact('business_name'))->send();
     $existing_contacts = Contact::whereNull('user_id')->whereNotNull('email')->where('email', '<>', '')->where(['email' => $request->input('email')])->get();
     foreach ($existing_contacts as $existing_contact) {
         if ($existing_contact->isSubscribedTo($business)) {
             auth()->user()->contacts()->save($existing_contact);
             Flash::warning(trans('user.contacts.msg.store.warning.already_registered'));
             return redirect()->route('user.business.contact.show', [$business, $existing_contact]);
         }
         $business->contacts()->attach($existing_contact);
         $business->save();
         Flash::warning(trans('user.contacts.msg.store.warning.showing_existing_contact'));
         return redirect()->route('user.business.contact.show', [$business, $existing_contact]);
     }
     $contact = Contact::create(Request::all());
     $contact->user()->associate(auth()->user()->id);
     $contact->save();
     $business->contacts()->attach($contact);
     $business->save();
     Flash::success(trans('user.contacts.msg.store.success'));
     return redirect()->route('user.business.contact.show', [$business, $contact]);
 }
开发者ID:martinsv,项目名称:timegrid,代码行数:33,代码来源:BusinessContactController.php

示例3: sendContact

 /**
  * Procesa el formulario de contacto
  *
  * @param ContactRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function sendContact(ContactRequest $request)
 {
     $contacto = Contact::create($request->all());
     event(new ContactFormHasSent($contacto));
     Flash::success('Mensaje enviado de manera correcta');
     return redirect()->back();
 }
开发者ID:JuaninTorres,项目名称:openagora-web,代码行数:13,代码来源:ContactController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateContactRequest $request)
 {
     $actif = 'contact';
     Contact::create($request->all());
     $id = $request->societe_id;
     return redirect(route('societe.show', $id));
 }
开发者ID:blackdavinci,项目名称:crm-ftz,代码行数:12,代码来源:ContactController2.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(ContactRequest $request)
 {
     //
     $input = Request::all();
     Contact::create($input);
     return redirect('contacts');
 }
开发者ID:seahouse,项目名称:hxerp,代码行数:13,代码来源:ContactsController.php

示例6: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @param $authenticated_user
  * @return CRUDResultData
  */
 protected function create(array $data, $authenticated_user)
 {
     $creation_data = new CRUDResultData();
     $validator = $this->validator($data);
     Log::info(print_r($data, true));
     if (!$validator->fails() && isset($authenticated_user) && isset($authenticated_user->id)) {
         $contact = Contact::create(['first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'user_id' => $authenticated_user->id]);
         if ($contact->exists) {
             if (array_key_exists('added_email', $data)) {
                 foreach ($data['added_email'] as $key => $email) {
                     ContactEmail::create(['contact_id' => $contact->id, 'email' => $email, 'primary' => array_key_exists($key, $data['primary_email'])]);
                 }
             }
             ContactNumber::create(['contact_id' => $contact->id, 'phone_number' => $data['phone_number']]);
             if (array_key_exists('additional_number', $data)) {
                 foreach ($data['additional_number'] as $phone_number) {
                     ContactNumber::create(['contact_id' => $contact->id, 'phone_number' => $phone_number]);
                 }
             }
         } else {
             $creation_data->success = false;
             $creation_data->errors = $validator->errors()->all();
         }
         $creation_data->success = true;
     } else {
         $creation_data->success = false;
         $creation_data->errors = $validator->errors()->all();
     }
     return $creation_data;
 }
开发者ID:jsrc1115,项目名称:VOIQTest,代码行数:37,代码来源:ContactsController.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required', 'address' => 'required', 'phone' => 'required']);
     $input = $request->all();
     Contact::create($input);
     return redirect()->back();
 }
开发者ID:jacklynlee31,项目名称:address-book,代码行数:13,代码来源:ContactsController.php

示例8: store

 /**
  * 新增客户联系人
  *
  * @param Request $request
  * @return mixed
  */
 public function store(Request $request)
 {
     // 先验证
     $this->validate($request, ['name' => 'required', 'phone' => 'required|digits:11', 'address' => 'required']);
     Contact::create(['name' => Input::get('name'), 'phone' => Input::get('phone'), 'address' => Input::get('address')]);
     return response()->json(['success' => true]);
 }
开发者ID:supermason,项目名称:homestreward,代码行数:13,代码来源:ContactController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $this->validate($request, ['fullName' => 'required', 'email' => 'required|email', 'role' => 'required', 'schoolName' => 'required', 'message' => 'required']);
     $input = $request->all();
     $newContact = Contact::create($input);
     return response()->json($newContact);
 }
开发者ID:piyushchauhan2011,项目名称:clickview-test,代码行数:14,代码来源:ContactController.php

示例10: stroemessage

 public function stroemessage()
 {
     if (Contact::create(Input::all())) {
         return Redirect::back()->withErros(Null);
     } else {
         return Redirect::back()->withErros('Store fail!');
     }
 }
开发者ID:luowc302,项目名称:SelfProject,代码行数:8,代码来源:HomeController.php

示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // We want to delete the table if it exists before running the seed
     DB::table('contact')->delete();
     $seederData = array(['map_url' => 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d14228.54849623564!2d-80.10342101116558!3d26.930867031043434!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x88d93335441a6f7d%3A0xdc51486fff899a21!2sJupiter%2C+FL%2C+USA!5e0!3m2!1sen!2sin!4v1433741837407', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua']);
     foreach ($seederData as $item) {
         Contact::create($item);
     }
 }
开发者ID:shotaK,项目名称:ExcursionApp,代码行数:14,代码来源:ContactTableSeeder.php

示例12: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     // Validate
     $this->validate($request, ['name' => 'required', 'phone' => 'required|min:10|numeric', 'notes' => 'max:255']);
     $data = array_merge($request->all(), array("user_id" => \Auth::user()->id));
     Contact::create($data);
     // Save
     return redirect("contacts")->with('flash_message', 'Contact has been created successfully.');
 }
开发者ID:erviveksharma,项目名称:phonebook,代码行数:14,代码来源:ContactsController.php

示例13: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $sendEmail = Mail::send('emails.contact', ['contact' => collect($this->request)], function ($mail) {
         $mail->from('contact@chakosh.ir', 'Chakosh Contact Form Service');
         // first user is admin
         $admin = User::findOrFail(1);
         $mail->to($admin->email, $admin->name)->subject('New message');
     });
     Contact::create($this->request);
 }
开发者ID:amirmasoud,项目名称:chakoshLaravelBlog,代码行数:15,代码来源:SendContactEmail.php

示例14: createContact

 function createContact()
 {
     $contact = array("name" => Input::get('ad'), "email" => Input::get('email'), "message" => Input::get('mesaj'));
     $create = Contact::create($contact);
     if ($create) {
         return '<p style="color: green">Mesajınız İletildi.</p>';
     } else {
         return '<p style="color: red">Mesajınız İletilmedi.</p>';
     }
 }
开发者ID:ufukpalavar52,项目名称:laravel-php-projelerim,代码行数:10,代码来源:ContactsController.php

示例15: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create(Request $request)
 {
     $this->validate($request, ['name' => 'required|between:3,255', 'email' => 'required|email', 'title' => 'required|between:5,255', 'content' => 'required|between:3,1024', 'g-recaptcha-response' => 'required']);
     $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Ld28RYTAAAAAAlTyuuvYmdxQfUQeG8KIMIcqK_U&response=" . $request['g-recaptcha-response'] . "&remoteip=" . $_SERVER['REMOTE_ADDR']), true);
     if ($response == false) {
         return redirect()->route('contact')->with('message', 'تحقق الشخصية خاطئ!')->with('alert-class', 'alert-warning');
     }
     Contact::create(['name' => $request['name'], 'email' => $request['email'], 'title' => $request['title'], 'content' => $request['content']]);
     return redirect()->route('contact')->with('message', 'تم إرسال رسالة التواصل بنجاح!')->with('alert-class', 'alert-success');
 }
开发者ID:MostafaEllethy,项目名称:alexsport,代码行数:15,代码来源:ContactController.php


注:本文中的app\Contact::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。