本文整理汇总了PHP中Client::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::where方法的具体用法?PHP Client::where怎么用?PHP Client::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postView
/**
* View a blog post.
*
* @param string $slug
* @return Redirect
*/
public function postView($slug)
{
$user = $this->user->currentUser();
// Get this blog post data
$client = $this->client->where('slug', '=', $slug)->first();
// Redirect to this blog post page
return Redirect::to($slug);
}
示例2: index
/**
* Display a listing of clients
*
* @return Response
*/
public function index()
{
$user = Auth::user()->id;
// Grab all the user clients
$clients = $this->client->where('user_id', $user)->get();
//Include deleted clients
if (Input::get('withTrashed')) {
} else {
if (Input::get('onlyTrashed')) {
$clients = $this->client->onlyTrashed()->where('user_id', $user)->get();
}
}
return View::make('clients.index', compact('clients'));
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$credit = Credit::createNew();
$last_credit = Credit::where('account_id', '=', Auth::user()->account_id)->where('client_id', '=', Input::get('client'))->max('credit_number');
if (!$last_credit) {
$last_credit = 0;
}
$credit->setClient(Input::get('client'));
//Client::getPrivateId(Input::get('client'));
$dateparser = explode("/", Input::get('credit_date'));
$date = $dateparser[2] . '-' . $dateparser[1] . '-' . $dateparser[0];
$credit->setCreditDate(date($date));
$credit->setAmount(Input::get('amount'));
$credit->setBalance(Input::get('amount'));
$credit->setPrivateNotes(trim(Input::get('private_notes')));
$credit->setUser(Auth::user()->id);
$credit->setCreditNumber($last_credit + 1);
$error = $credit->guardar();
if ($error) {
Session::flash('error', $error);
return Redirect::to('creditos/create');
}
$credit->save();
Session::flash('message', 'Crédito creado con éxito');
$client = Client::where('id', '=', Input::get('client'))->first();
return Redirect::to('clientes/' . $client->public_id);
}
示例4: authenticate
public function authenticate()
{
$username = Input::get('username');
$password = Input::get('password');
$captcha_string = Input::get('g-recaptcha-response');
$captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string);
$captcha_json = json_decode($captcha_response);
if ($captcha_json->success) {
if (Auth::attempt(['loginClient' => $username, 'password' => $password], true)) {
// Gestion de la connexion administrateur via le front-office
$is_admin = Client::where('loginClient', '=', $username)->firstOrFail()->admin;
if ($is_admin == '1') {
Session::put('admin', '1');
} else {
Session::put('admin', '0');
}
Session::flash('flash_msg', "Vous êtes maintenant connecté.");
Session::flash('flash_type', "success");
return Redirect::to('/account');
} else {
Session::flash('flash_msg', "Identifiants incorrects, veuillez réessayer.");
Session::flash('flash_type', "fail");
return Redirect::to('/login');
}
} else {
Session::flash('flash_msg', "Champ de vérification incorrect ou non coché.");
Session::flash('flash_type', "fail");
return Redirect::to(URL::previous());
}
}
示例5: testClientDeletePost
public function testClientDeletePost()
{
$client = Client::where('name', '=', 'TestClient2')->firstOrFail();
$this->call('POST', '/client/delete/' . $client->id);
$this->assertRedirectedTo('/client/list');
$this->assertSessionHas('success');
}
示例6: __construct
public function __construct()
{
$this->beforeFilter('auth.admin');
$this->hasUnverifiedUsers = Client::where('is_verified', '=', 0)->count();
$this->hasUsersInWaitlist = Client::where('on_waitlist', '=', 1)->count();
View::share('actionName', explode('@', Route::currentRouteAction())[1]);
$this->userRules = array('email' => 'required|email', 'first_name' => 'required', 'last_name' => 'required');
}
示例7: manage
/**
* Load the manage clients page.
* @param String $lrs_id
* @return View
*/
public function manage($lrs_id)
{
$opts = ['user' => \Auth::user()];
$lrs = $this->lrs->show($lrs_id, $opts);
$lrs_list = $this->lrs->index($opts);
$clients = \Client::where('lrs_id', $lrs->id)->get();
return View::make('partials.client.manage', ['clients' => $clients, 'lrs' => $lrs, 'list' => $lrs_list]);
}
示例8: show
public function show($id)
{
$group = Group::scope($id)->firstOrFail();
print_r($group->id);
$clients = Client::where('group_id', '=', $group->id)->select('clients.id', 'clients.nit', 'clients.name', 'clients.public_id')->get();
$clientes = array();
foreach ($clients as $key => $client) {
array_push($clientes, $client);
}
return View::make('groups.show', array('group' => $group, 'clients' => $clientes, 'showBreadcrumbs' => false));
}
示例9: dashboard
public function dashboard()
{
$sucursales = Branch::where('account_id', Auth::user()->account_id)->get();
$usuarios = Account::find(Auth::user()->account_id)->users;
//$clientes = Account::find(Auth::user()->account_id)->clients;
$clientes = Client::where('account_id', Auth::user()->account_id)->count();
$productos = Account::find(Auth::user()->account_id)->products;
$informacionCuenta = array('sucursales' => sizeof($sucursales), 'usuarios' => sizeof($usuarios), 'clientes' => $clientes, 'productos' => sizeof($productos));
// return Response::json($informacionCuenta);
return View::make('cuentas.dashboard')->with('cuenta', $informacionCuenta);
}
示例10: destroy
/**
* Remove the specified resource from storage.
* DELETE /users/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
// Delete everything related to the user
Task::where('user_id', Auth::id())->delete();
Credential::where('user_id', Auth::id())->delete();
Project::where('user_id', Auth::id())->delete();
Client::where('user_id', Auth::id())->delete();
User::where('id', Auth::id())->delete();
// Logout and redirect back to home page
Auth::logout();
return Redirect::to('/');
}
示例11: search
/**
* Run a general search.
* @return array of objects with the search results.
*/
public function search()
{
$q = Input::get("q");
// redirect user back if nothing was typed
if (empty(trim($q))) {
return Redirect::back();
}
$clients = Client::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
$projects = Project::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
$tasks = Task::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
$pTitle = "Search Results";
return View::make('search', compact('q', 'clients', 'projects', 'tasks', 'pTitle'));
}
示例12: getInvoices
public function getInvoices()
{
$invoices = Invoice::where('account_id', Auth::user()->account_id)->where('branch_id', Session::get('branch_id'))->select('public_id', 'invoice_status_id', 'client_id', 'invoice_number', 'invoice_date', 'importe_total', 'branch_name')->orderBy('public_id', 'DESC')->get();
foreach ($invoices as $key => $invoice) {
$invoice_razon = Client::where('account_id', Auth::user()->account_id)->select('name')->where('id', $invoice->client_id)->first();
$invoice->razon = $invoice_razon->name;
$estado = InvoiceStatus::where('id', $invoice->invoice_status_id)->first();
$invoice->estado = $estado->name;
$invoice->accion = "<a class='btn btn-primary btn-xs' data-task='view' href='factura/{$invoice->public_id}' style='text-decoration:none;color:white;'><i class='glyphicon glyphicon-eye-open'></i></a> <a class='btn btn-warning btn-xs' href='copia/{$invoice->public_id}' style='text-decoration:none;color:white;'><i class='glyphicon glyphicon-duplicate'></i></a>";
}
$invoiceJson = ['data' => $invoices];
return Response::json($invoiceJson);
}
示例13: clientList
public function clientList($id = null)
{
if ($id == null) {
$clients = Client::all(array('id', 'name'));
} else {
$clients = Client::where('id_user', '=', Auth::user()->id)->get(array('id', 'name'));
}
$clientsRow = array();
$clientsRow[0] = "Cliente";
foreach ($clients as $client) {
$clientsRow[$client["id"]] = $client["name"];
}
return $clientsRow;
}
示例14: updatemotdepasse
public function updatemotdepasse($token)
{
$client = Client::where('token', '=', $token)->firstOrFail();
$input = ["password1" => Input::get('password1'), "password2" => Input::get('password2'), "mdpClient" => Hash::make(Input::get('password1'))];
$messages = array('required' => ":attribute est requis pour changer votre mot de passe.", 'same' => 'Les mots de passe ne correspondent pas', 'min' => "Le mot de passe entré est trop court (5 car. mini)");
$rules = array('password1' => 'required|same:password2|min:5', 'password2' => 'required');
$validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) {
$messages = $validator->messages();
return Redirect::to(URL::previous())->withErrors($validator);
} else {
Session::flash('flash_msg', "Le mot de passe a bien été changé.");
Session::flash('flash_type', "success");
$client->mdpClient = $input['mdpClient'];
$client->token = '';
$client->save();
return Redirect::to("/login");
}
}
示例15: action_check_id
public function action_check_id()
{
try {
$jwt = $this->authserver->getRequest()->get()['access_token'];
//Get Token header and payload
$content = JWT::decode($this->authserver->getRequest()->get()['access_token'], null, false);
$client_id = DB::table('oauth_client_metadata')->where('key', 'website')->where('value', $content->aud)->first()->client_id;
$client_secret = Client::where('id', $client_id)->first()->secret;
//Verify Signature
$response = JWT::decode($this->authserver->getRequest()->get()['access_token'], $client_secret);
} catch (League\OAuth2\Server\Exception\ClientException $e) {
// Throw an exception because there was a problem with the client's request
$response = array('error' => $this->authserver->getExceptionType($e->getCode()), 'error_description' => $e->getMessage());
// Set the correct header
header($this->authserver->getExceptionHttpHeaders($this->authserver->getExceptionType($e->getCode()))[0]);
} catch (Exception $e) {
// Throw an error when a non-library specific exception has been thrown
$response = array('error' => 'undefined_error', 'error_description' => $e->getMessage());
}
header('Content-type: application/json');
echo json_encode($response);
}