本文整理汇总了PHP中Contact::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::where方法的具体用法?PHP Contact::where怎么用?PHP Contact::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postSearch
public function postSearch()
{
$name = Input::get('query');
//$posts=DB::table('contacts')->select('name', 'email')->get();
$posts = Contact::where('name', 'LIKE', "%{$name}%")->get();
return View::make('contacts.showcontacts')->with('contacts', $posts);
}
示例2: sendEmail
public function sendEmail()
{
$contacts = Contact::where('user_id', Auth::user()->id)->lists('full_name', 'id');
$templates = EmailTemplate::lists('subject', 'id');
$list_templates = EmailTemplate::all();
return View::make('users.send', compact('contacts', 'templates', 'list_templates'));
}
示例3: showMemberContacts
public function showMemberContacts()
{
$memberCollection = array();
if (Auth::user()->isAdmin()) {
$contacts = Contact::all();
} else {
$contacts = Contact::where('user_id', Auth::user()->id)->get();
$memberCollection = MemberAPI::getmemberapiselect(Auth::user()->id);
foreach ($memberCollection as $member) {
if (!User::find($member->member_id)) {
$user = new User();
$user->id = $member->member_id;
$user->username = $member->username;
$user->name = $member->name;
$user->password = Hash::make(rand());
$user->active = 1;
$user->save();
}
$membercontacts = Contact::where('user_id', $member->member_id)->get();
$contacts = $contacts->merge($membercontacts);
}
// return $contacts->toJson();
}
return View::make('contacts.member', compact('contacts', 'memberCollection'));
}
示例4: getContacts
public function getContacts()
{
$id = Input::get('id');
//return Response::json($id);
$contacts = Contact::where('client_id', '=', $id)->whereNull('deleted_at')->select('id', 'first_name', 'last_name', 'email', 'phone')->get();
$client = Client::where('id', $id)->firstOrFail();
$enviar = ['contact' => $contacts, 'note' => $client->private_notes];
return Response::json($enviar);
}
示例5: getSingle
/**
* Show the form for creating a new resource.
* GET /api\apicontact/create
*
* @return Response
*/
public function getSingle($id)
{
try {
$contact = Contact::where('published', 1)->where('id', $id)->firstOrFail();
$this->googleAnalytics('/contacts/single/' . $id);
return Response::json($contact);
} catch (Exception $e) {
return Response::json(array('status' => 'fail'));
}
}
示例6: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
if (Session::get('user_level') < Config::get('cms.viewContacts')) {
return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning');
}
$this->setLayout();
if (Input::get('q')) {
$contacts = Contact::where('first_name', 'LIKE', '%' . Input::get('q') . '%')->orWhere(function ($query) {
$query->where('last_name', 'LIKE', '%' . Input::get('q') . '%');
})->orderBy('created_at', 'desc')->paginate(20);
} else {
$contacts = Contact::orderBy('created_at', 'desc')->paginate(20);
}
View::share('title', Lang::get('admin.allContacts'));
View::share('contacts', $contacts);
$this->layout->content = View::make('backend.puskice.contacts.index');
}
示例7: getClients
public function getClients()
{
$clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'public_id', 'name', 'nit', 'custom_value4', 'work_phone', 'business_name')->orderBy('name', 'ASC')->get();
//$clientes= Client::where('account_id', Auth::user()->account_id)->orderBy('name', 'ASC')->get();
//return $clientes;
//return Response::json($clientes);
foreach ($clientes as $key => $client) {
$contact = Contact::where('account_id', Auth::user()->account_id)->where('client_id', $client->id)->first();
$client->name2 = "<a href='clientes/{$client->public_id}'>{$client->name}</a>";
$client->business = "<a href='clientes/{$client->public_id}'>{$client->business_name}</a>";
$client->nit2 = "<a href='clientes/{$client->public_id}'>{$client->nit}</a>";
$client->contacto = "<a href='#'>{$contact->last_name} {$contact->first_name}</a>";
$client->campo = "<a href='clientes/{$client->public_id}'>{$client->custom_value4}</a>";
$client->button = "<a class='btn btn-primary btn-xs' data-task='view' href='clientes/{$client->public_id}' style='text-decoration:none;color:white;'><i class='glyphicon glyphicon-eye-open'></i></a> <a class='btn btn-warning btn-xs' href='clientes/{$client->public_id}/edit' style='text-decoration:none;color:white;'><i class='glyphicon glyphicon-edit'></i></a>";
}
$clientJson = ['data' => $clientes];
return Response::json($clientJson);
}
示例8: json_encode
} else {
$data['msg'] = 'The contact should have at least one address!';
}
$contactList->response()->header('Content-Type', 'application/json');
echo json_encode($data);
});
// Check email address
$contactList->post("/checkemail", function () use($contactList) {
$email = $contactList->request->params('email');
$checkEmail = Contact::where('email', '=', $email)->count();
if ($checkEmail == 0) {
$data['available'] = true;
} else {
$data['available'] = false;
}
$contactList->response()->header('Content-Type', 'application/json');
echo json_encode($data);
});
// Check email address
$contactList->post("/checkemail/:id", function ($id) use($contactList) {
$email = $contactList->request->params('email');
$checkEmail = Contact::where('email', '=', $email)->where('id', '<>', $id)->count();
if ($checkEmail == 0) {
$data['available'] = true;
} else {
$data['available'] = false;
}
$contactList->response()->header('Content-Type', 'application/json');
echo json_encode($data);
});
$contactList->run();
示例9: copia
public function copia($id)
{
$invoice = Invoice::where('id', $id)->first(array('id', 'account_name', 'account_nit', 'account_uniper', 'account_uniper', 'address1', 'address2', 'terms', 'importe_neto', 'importe_total', 'branch_name', 'city', 'client_id', 'client_name', 'client_nit', 'control_code', 'deadline', 'discount', 'economic_activity', 'end_date', 'invoice_date', 'invoice_status_id', 'invoice_number', 'number_autho', 'phone', 'public_notes', 'qr', 'logo', 'public_id', 'note', 'sfc', 'type_third', 'branch_id', 'state', 'law', 'phone', 'javascript'));
$account = Account::find(Auth::user()->account_id);
//return $invoice['id'];
$products = InvoiceItem::where('invoice_id', $invoice->id)->get();
$invoice['invoice_items'] = $products;
$invoice['third'] = $invoice->type_third;
$invoice['is_uniper'] = $account->is_uniper;
$invoice['uniper'] = $account->uniper;
$invoice['logo'] = $invoice->getLogo();
$client_id = $invoice->getClient();
$client = DB::table('clients')->where('id', '=', $client_id)->first();
$contacts = Contact::where('client_id', $client->id)->get(array('id', 'is_primary', 'first_name', 'last_name', 'email'));
$status = InvoiceStatus::where('id', $invoice->invoice_status_id)->first();
//echo $client_id;
//print_r($contacts);
// return 0;
if ($invoice->note == "") {
$nota = [];
} else {
$nota = json_decode($invoice['note']);
}
$data = array('invoice' => $invoice, 'account' => $account, 'products' => $products, 'contacts' => $contacts, 'nota' => $nota, 'copia' => 1, 'matriz' => Branch::scope(1)->first(), 'status' => $status->name == "Parcial" ? "Parcialmente Pagado" : $status->name);
// return Response::json($data);
return View::make('factura.show', $data);
}
示例10: array
function employee_get()
{
$filters = $this->get("filter")["filters"];
$data["results"] = array();
$data["count"] = 0;
$obj = new Contact(null, $this->entity);
$obj->where("contact_type_id", 3);
$obj->get();
foreach ($obj as $value) {
//Results
$data["results"][] = array("id" => $value->id, "name" => $value->surname . ' ' . $value->name);
}
//Response Data
$this->response($data, 200);
}
示例11: indexDown
public function indexDown($name = null, $numero = null, $nit = null, $group = null, $contact = null)
{
$name = Input::get('name');
$numero = Input::get('numero');
$nit = Input::get('nit');
$group = Input::get('group');
$contact = Input::get('contact');
if (Session::get('sw') == 'DESC') {
Session::put('sw', 'ASC');
} else {
Session::put('sw', 'DESC');
}
$sw = Session::get('sw');
if ($numero == "" && $name == "" && $nit == "" && $group == "" && $contact == "") {
$clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'business_name', 'nit', 'created_at', 'group_id')->orderBy('id', $sw)->simplePaginate(30);
foreach ($clientes as $key => $client) {
$contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first();
$client->contacto_first_name = $contacts->first_name;
$client->contacto_last_name = $contacts->last_name;
}
return View::make('clientes.index', array('clients' => $clientes, 'sw' => 'ASC', 'contacts' => $contacts));
}
if ($numero) {
$clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'business_name', 'nit', 'created_at', 'group_id')->where('id', 'like', $numero . "%")->orderBy('id', $sw)->simplePaginate(30);
foreach ($clientes as $key => $client) {
$contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first();
$client->contacto_first_name = $contacts->first_name;
$client->contacto_last_name = $contacts->last_name;
}
$data = ['clients' => $clientes, 'numero' => $numero, 'name' => $name, 'nit' => $nit, 'create' => $create];
return View::make('clientes.index', $data);
}
if ($name) {
$clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'business_name', 'nit', 'created_at', 'group_id')->where('business_name', 'like', $name . "%")->orderBy('business_name', $sw)->simplePaginate(30);
// $clientes = Client::join('contacts', 'clients.id' ,'=', 'contacts.client_id')
// ->where('business_name', 'like', $name."%")
// ->select('clients.id', 'clients.business_name', 'clients.nit', 'clients.created_at', 'contacts.first_name', 'contacts.last_name')
// ->orderBy('business_name', $sw)
// ->simplePaginate(30);
foreach ($clientes as $key => $client) {
$contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first();
$client->contacto_first_name = $contacts->first_name;
$client->contacto_last_name = $contacts->last_name;
}
// return $clientes;
$data = ['clients' => $clientes, 'numero' => $numero, 'name' => $name, 'nit' => $nit, 'create' => $create];
return View::make('clientes.index', $data);
}
if ($nit) {
$clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'business_name', 'nit', 'created_at', 'group_id')->where('nit', 'like', $nit . "%")->orderBy('nit', $sw)->simplePaginate(30);
foreach ($clientes as $key => $client) {
$contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first();
$client->contacto_first_name = $contacts->first_name;
$client->contacto_last_name = $contacts->last_name;
}
$data = ['clients' => $clientes, 'numero' => $numero, 'name' => $name, 'nit' => $nit, 'create' => $create];
return View::make('clientes.index', $data);
}
// if ($create) {
//
// $clientes = Client::where('account_id', Auth::user()->account_id)
// ->select('id', 'business_name', 'nit', 'created_at', 'group_id')
// ->where('created_at', 'like', $create."%")
// ->orderBy('created_at', $sw)
// ->simplePaginate(30);
// foreach ($clientes as $key => $client) {
// $contacts = Contact::where('account_id', Auth::user()->account_id)
// ->select('first_name', 'last_name')
// ->where('client_id', $client->id)
// ->first();
// $client->contacto_first_name = $contacts->first_name;
// $client->contacto_last_name = $contacts->last_name;
// }
//
// $data = [
// 'clients' => $clientes,
// 'numero' => $numero,
// 'name' => $name,
// 'nit' => $nit,
// 'create' => $create
// ];
// return View::make('clientes.index', $data);
// }
if ($group) {
$clientes = Client::join('groups', 'clients.group_id', '=', 'groups.id')->select('clients.id', 'clients.nit', 'clients.business_name', 'clients.created_at', 'clients.group_id')->where('groups.name', 'like', $group . '%')->orderBy('groups.name', $sw)->simplePaginate(30);
foreach ($clientes as $key => $client) {
$contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first();
$client->contacto_first_name = $contacts->first_name;
$client->contacto_last_name = $contacts->last_name;
}
$data = ['clients' => $clientes, 'group' => $group];
return View::make('clientes.index', $data);
}
if ($contact) {
$clientes = Client::join('contacts', 'clients.id', '=', 'contacts.client_id')->select('clients.id', 'clients.nit', 'clients.business_name', 'clients.created_at', 'clients.group_id', 'contacts.first_name', 'contacts.last_name')->where('contacts.first_name', 'like', $contact . "%")->orderBy('contacts.first_name', $sw)->simplePaginate(30);
foreach ($clientes as $key => $client) {
$client->contacto_first_name = $client->first_name;
$client->contacto_last_name = $client->last_name;
}
$data = ['clients' => $clientes, 'contact' => $contact];
//.........这里部分代码省略.........
示例12: findClientContactsArray
public static function findClientContactsArray($id_client = null)
{
return Contact::where('id_client', '=', $id_client)->get(array('id', 'firstname', 'lastname'));
}
示例13: update
/**
* Update the specified resource in storage.
* PUT /contact/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
Input::merge(array_map('trim', Input::all()));
$input = Input::all();
$validation = Validator::make($input, Contact::$rules);
$gettime = time() - 14400;
$datetime_now = date("H:i:s", $gettime);
if (Input::get('fullname') == 'No record found.') {
return Redirect::route('contact.edit')->withInput()->with('class', 'error')->with('message', 'Input proper fullname.');
}
if ($validation->passes()) {
if (Input::get('category') == '1') {
$street = Input::get('street_hid');
$city = Input::get('city_hid');
$province = Input::get('province_hid');
$country = Input::get('country_hid');
$zip_code = Input::get('zip_code_hid');
$street_2 = Input::get('street_2');
$city_2 = Input::get('city_2');
$province_2 = Input::get('province_2');
$country_2 = Input::get('country_2');
$zip_code_2 = Input::get('zip_code_2');
} else {
$street = Input::get('i_street');
$city = Input::get('i_city');
$province = Input::get('i_province');
$country = Input::get('i_country');
$zip_code = Input::get('i_zip_code');
$street_2 = Input::get('street_2');
$city_2 = Input::get('city_2');
$province_2 = Input::get('province_2');
$country_2 = Input::get('country_2');
$zip_code_2 = Input::get('zip_code_2');
}
if ($street == "" || $city == "" || $country == "") {
return Redirect::route('contact.edit', $id)->withInput()->with('class', 'error')->with('message', 'Make sure to fill-up company address.');
}
$contact = Contact::find($id);
if (is_null($contact)) {
return Redirect::route('contact.edit', $id)->withInput()->withErrors($validation)->with('class', 'warning')->with('message', 'Contact information not exist.');
}
$contact->position = Input::get('profession');
$contact->fullname = strtoupper(Input::get('fullname'));
$contact->gender = strtoupper(Input::get('gender'));
$contact->category = Input::get('category');
$contact->company = Input::get('company');
$contact->in_company_position = Input::get('position');
$contact->street = strtoupper($street);
$contact->city = strtoupper($city);
$contact->province = strtoupper($province);
$contact->country = strtoupper($country);
$contact->zip_code = strtoupper($zip_code);
$contact->street_2 = strtoupper($street_2);
$contact->city_2 = strtoupper($city_2);
$contact->province_2 = strtoupper($province_2);
$contact->country_2 = strtoupper($country_2);
$contact->zip_code_2 = strtoupper($zip_code_2);
$contact->contact_number = Input::get('contact_number');
$contact->contact_number2 = Input::get('2nd_contact_number');
$contact->contact_number3 = Input::get('3rd_contact_number');
$contact->status = 1;
// if(Contact::check_ifcontactinfoExist($contact))
// {
// return Redirect::route('contact.edit', $id)
// ->withInput()
// ->withErrors($validation)
// ->with('class', 'warning')
// ->with('message', 'Record was already added by BDO.');
// }
$contactinformation = DB::table('contacts')->select('contacts.*', 'positions.position as cp_position')->join('positions', 'positions.id', '=', 'contacts.position')->where('contacts.id', $id)->first();
$pos = DB::table('positions')->where('id', Input::get('position'))->first();
if ($contactinformation->company != '0') {
$comp = Company::where('id', $contactinformation->company)->first();
$companyname = $comp->company_name;
$new_comp = Company::where('id', Input::get('company'))->first();
$new_companyname = $new_comp->company_name;
} else {
$companyname = 'N/A';
$new_companyname = 'N/A';
}
if (Contact::where('position', Input::get('position'))->where('id', $id)->count() > 0) {
$position = "";
} else {
$position = "POSITION : " . $contactinformation->cp_position . " INTO " . strtoupper($pos->position) . ", ";
}
if (Contact::where('fullname', strtoupper(Input::get('fullname')))->where('id', $id)->count() > 0) {
$fullname = "";
} else {
$fullname = "FULLNAME : " . $contactinformation->fullname . " INTO " . strtoupper(Input::get('fullname')) . ", ";
}
if (Contact::where('gender', strtoupper(Input::get('gender')))->where('id', $id)->count() > 0) {
$gender = "";
} else {
//.........这里部分代码省略.........
示例14: postUpdateCustomer
public function postUpdateCustomer()
{
$company = Session::get('companyID');
$contact = Session::get('contactID');
$editedContact = Contact::where('contact_id', '=', $contact)->first();
$validator = Validator::make(Input::all(), array('name' => 'required|max:100', 'email' => 'required|email|max:200', 'number' => 'required|max:100'));
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
} else {
$name = Input::get('name');
$email = Input::get('email');
$number = Input::get('number');
$editedContact->contact_name = $name;
$editedContact->email = $email;
$editedContact->contact_number = $number;
$updatedContact = $editedContact->save();
if ($updatedContact) {
return Redirect::route('dashboard');
} else {
return Redirect::route('contactEdit');
}
}
}
示例15: contactList
public function contactList($id_client)
{
$contacts = Contact::where('id_client', '=', $id_client)->get(array('id', 'firstname', 'lastname'));
$contactsRow = array();
$contactsRow[0] = "Contacto con el cliente";
foreach ($contacts as $contact) {
$contactsRow[$contact->id] = $contact->fullname();
}
return $contactsRow;
}