本文整理汇总了PHP中app\Contact类的典型用法代码示例。如果您正苦于以下问题:PHP Contact类的具体用法?PHP Contact怎么用?PHP Contact使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Contact类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleProviderCallback
/**
* Obtain the user information from GitHub.
*
* @return Response
*/
public function handleProviderCallback()
{
$socialiteUser = Socialite::driver('github')->user();
//If the org filter is set get the users organisations and check them
if (!empty(env('VALID_GITHUB_ORG'))) {
$this->github->authenticate(\Github\Client::AUTH_URL_TOKEN, $socialiteUser->token);
$organizations = $this->github->currentUser()->memberships()->all();
$loginValid = false;
foreach ($organizations as $org) {
if ($org['organization']['login'] === env('VALID_GITHUB_ORG')) {
$loginValid = true;
}
}
if (!$loginValid) {
return redirect('/login')->withError('Not a member of the required organisation');
}
}
//Locate a user or create an account
$user = User::where('email', $socialiteUser->getEmail())->first();
if (!$user) {
$user = User::create(['email' => $socialiteUser->getEmail(), 'name' => $socialiteUser->getName()]);
//Add a contact record for the user so they receive update notifications
$contact = new Contact();
$contact->name = $user->name;
$contact->email = $user->email;
$contact->filter_tags = [];
$contact->active = true;
$contact->save();
}
Auth::login($user, true);
return redirect('/pings');
}
示例2: store
public function store(Request $request)
{
// Validation
$this->validate($request, ['email' => 'required', 'message' => 'required|between:20,300']);
$contact = new Contact($request->all());
$contact->save();
// return $request->all();
return redirect('contact');
}
示例3: 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|max:255']);
$contact = new Contact();
$contact->name = $request->name;
$contact->save();
$id = $contact->id;
return redirect('/contacts/' . $id);
}
示例4: store
public function store(Requests\ContactRequest $request)
{
$contact = new Contact();
$contact->name = $request::get('name');
$contact->name = $request::get('phone_num');
$contact->email = $request::get('email');
$contact->message = $request::get('description');
$contact->save();
return \Redirect::back()->with('message', 'Your request has been submitted successfully. We will get back to you soon');
}
示例5: sendMessage
/**
* Fungsi untuk Pengiriman data setelah user mengirimknan pesan
*/
public function sendMessage(Request $request)
{
$contact = new Contact();
$contact->name = $request->get('name');
$contact->phone = $request->get('phone');
$contact->email = $request->get('email');
$contact->message = $request->get('message');
$contact->save();
Session::flash('send', 'Data Berhasil di kirim');
return Redirect('/contactUs');
}
示例6: postContactUs
public function postContactUs(ContactPostRequest $request)
{
// dd($request->name);
$contact_us = new Contact();
$contact_us->name = $request->name;
$contact_us->email = $request->email;
$contact_us->subject = $request->subject;
$contact_us->message = $request->message;
$contact_us->save();
return redirect($this->curYear . '/introduction/contact-us')->with('success', 'Pesan anda telah terkirim.');
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$contact = new Contact($request->all());
$contact->save();
$name = $request->name;
$email = $request->email;
$message = $request->message;
$technology = $request->technology;
$industry = $request->industry;
$this->sendConfirmation($name, $email, $technology, $industry, $message);
return redirect('/contact')->with('success', 'Message successfully submitted');
}
示例8: store
public function store(ContactMeRequest $request)
{
$data = ['name' => $request->get('name'), 'email' => $request->get('email'), 'phone' => $request->get('phone'), 'message' => $request->get('message')];
$contacts = new Contact($data);
$contacts->save();
$data = ['name' => $request->get('name'), 'email' => $request->get('email'), 'phone' => $request->get('phone'), 'msg' => $request->get('message')];
Mail::send('contact/email_template', $data, function ($message) {
$message->from(Input::get('email'), 'Mail from contact page');
$message->to('polodev10@gmail.com')->subject("message from " . Input::get('name'));
$message->replyTo(Input::get('email'), Input::get('name'));
});
return redirect('contact')->withStatus('We will get back to you soon');
}
示例9: sendContact
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function sendContact(Request $request)
{
$email = \StringHelper::filterString($request->input('email'));
$name = \StringHelper::filterString($request->input('name'));
$content = \StringHelper::filterString($request->input('comments'));
if ($email != "" && $name != "" && $content != "") {
$contact = new Contact();
$contact->contact_name = $name;
$contact->contact_email = $email;
$contact->contact_content = $content;
$contact->save();
}
return Redirect::back()->with('message', 'Success');
}
示例10: store
/**
* Добавить контакт
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$contact = new \App\Contact($input = $request->input());
$validator = \Validator::make($contact->getAttributes(), $rules = self::getValidatorRules());
if ($validator->fails()) {
$this->throwValidationException($request, $validator);
}
$contact->created_by = \Auth::getUser()->id;
$contact->save();
Flash::success('Контакт успешно добавлен');
if (isset($input['add_new'])) {
return redirect(route('contact.create'));
}
return redirect(route('contact.show', $contact));
}
示例11: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$contacts = Contact::orderBy('id', 'desc')->paginate(10);
$option = Option::findOrFail(1);
$featured_properties = Property::where('Heat_inc', '=', 'Yes')->get();
return view('home', ['contacts' => $contacts, 'option' => $option, 'featured_properties' => $featured_properties]);
}
示例12: destroy
public function destroy(Request $request, $id)
{
$contact = Contact::find($id);
$contact->delete();
$request->session()->flash('alert-success', 'Message has been deleted successfully !');
return redirect('/message')->withInput();
}
示例13: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$contact = Contact::findOrFail($id);
$contact->delete();
Session::flash('message', 'Successfully Deleted your Data!');
return redirect()->back();
}
示例14: boot
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);
Contact::updating(function (Contact $contact) {
if ($new_values = $contact->getDirty()) {
if (isset($new_values['status'])) {
$message = \Lang::get('contact.status_update.' . $new_values['status']);
if ($contact->hasAttribute('change_status_comment')) {
if ($comment = $contact->getAttribute('change_status_comment')) {
$message .= PHP_EOL . $comment;
}
unset($contact->change_status_comment);
}
} else {
$values = [];
$old_values = $contact->getOriginal();
foreach ($new_values as $key => $value) {
$values[] = [$key, $old_values[$key], $value];
}
$message = 'json:' . json_encode($values);
}
$log = new ContactLog();
$log->contact_id = $contact->id;
$log->user_id = \Auth::getUser()->id;
$log->comment = $message;
$log->save();
}
});
}
示例15: 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();
}