本文整理匯總了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');
}
示例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]);
}
示例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();
}
示例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));
}
示例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');
}
示例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;
}
示例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();
}
示例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]);
}
示例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);
}
示例10: stroemessage
public function stroemessage()
{
if (Contact::create(Input::all())) {
return Redirect::back()->withErros(Null);
} else {
return Redirect::back()->withErros('Store fail!');
}
}
示例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);
}
}
示例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.');
}
示例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);
}
示例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>';
}
}
示例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');
}