本文整理汇总了PHP中app\models\Contact::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::where方法的具体用法?PHP Contact::where怎么用?PHP Contact::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Contact
的用法示例。
在下文中一共展示了Contact::where方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update Contact attributes.
*
* @param Business $business
* @param Contact $contact
* @param array $data
* @param string $notes
*
* @return void
*/
public function update(Business $business, Contact $contact, $data = [], $notes = null)
{
if (array_key_exists('birthdate', $data) && trim($data['birthdate']) != '') {
$data['birthdate'] = Carbon::createFromFormat(trans('app.dateformat.carbon'), $data['birthdate']);
}
$contact->where('id', '=', $contact->id)->update($data);
self::updateNotes($business, $contact, $notes);
}
示例2: 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);
}
示例3: 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;
}
示例4: search
public function search(Request $request)
{
$q = $request->input('search');
if (preg_match("/^[0-9]+\$/", $q)) {
$data = ['title' => 'Список контактов', 'view_all' => false, 'contacts' => Contact::get()->where('phone', $q)->toArray()];
return view('templates.index', $data);
} elseif (filter_var($q, FILTER_VALIDATE_EMAIL)) {
$data = ['title' => 'Список контактов', 'view_all' => false, 'contacts' => Contact::where('email', $q)->get()->toArray()];
return view('templates.index', $data);
} else {
$q = '%' . $q . '%';
$data = ['title' => 'Список контактов', 'view_all' => false, 'contacts' => Contact::where('fullname', 'LIKE', $q)->get()->toArray()];
//dd($data);
return view('templates.index', $data);
}
}
示例5: compose
/**
* Bind data to the view.
*
* @param View $view
*
* @return void
*/
public function compose(View $view)
{
$contactKey = session('contact_key');
if (!$contactKey) {
return false;
}
$contact = Contact::where('contact_key', '=', $contactKey)->with('client')->first();
if (!$contact || $contact->is_deleted) {
return false;
}
$client = $contact->client;
$hasDocuments = DB::table('invoices')->where('invoices.client_id', '=', $client->id)->whereNull('invoices.deleted_at')->join('documents', 'documents.invoice_id', '=', 'invoices.id')->count();
$view->with('hasQuotes', $client->quotes->count());
$view->with('hasCredits', $client->creditsWithBalance->count());
$view->with('hasDocuments', $hasDocuments);
}
示例6: reset
/**
* Reset the given user's password.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function reset(Request $request)
{
$this->validate($request, $this->getResetValidationRules());
$credentials = $request->only('password', 'password_confirmation', 'token');
$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;
}
}
$broker = $this->getBroker();
$response = Password::broker($broker)->reset($credentials, function ($user, $password) {
$this->resetPassword($user, $password);
});
switch ($response) {
case Password::PASSWORD_RESET:
return $this->getResetSuccessResponse($response);
default:
return $this->getResetFailureResponse($request, $response);
}
}
示例7: getContact
private function getContact()
{
$contactKey = session('contact_key');
if (!$contactKey) {
return false;
}
$contact = Contact::where('contact_key', '=', $contactKey)->first();
if (!$contact || $contact->is_deleted) {
return false;
}
return $contact;
}
示例8: linkToContacts
/**
* Link User to existing Contacts
*
* @return boolean The User was linked to at least one Contact
*/
public function linkToContacts()
{
$contacts = Contact::where(['email' => $this->email])->whereNotNull('email')->whereNull('user_id')->get();
if ($contacts->isEmpty()) {
return false;
}
foreach ($contacts as $contact) {
$contact->user()->associate($this)->save();
}
return true;
}
示例9: findExistingContactsByUserId
/**
* Find an existing Contact By UserId.
*
* @param int $userId
*
* @return Collection|Builder
*/
protected function findExistingContactsByUserId($userId)
{
return Contact::where('user_id', '=', $userId)->get();
}