本文整理汇总了PHP中Branch::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::find方法的具体用法?PHP Branch::find怎么用?PHP Branch::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
if (!isset($this->request->params['slug'])) {
$this->notice('invalid');
}
$branch = $this->Branch->find('first', array('conditions' => array('Branch.slug' => $this->request->params['slug'], 'Branch.active' => 1), 'contain' => array('Address' => array('fields' => array('Address.address'), 'Country' => array('fields' => array('Country.name'))), 'Contact')));
if (empty($branch)) {
$this->notice(__('The branch does not exsit'), array('redirect' => true));
}
$this->set('title_for_layout', sprintf(__('Contact us at %s'), $branch['Branch']['name']));
$this->set(compact('branch'));
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$student = Student::find($id);
if ($student == NULL) {
throw new Exception('Invalid Student ID');
}
$student->year = (int) substr($student->year, 2, 4);
$student_category = StudentCategories::find($student->category);
$student->category = $student_category->category;
$student_branch = Branch::find($student->branch);
$student->branch = $student_branch->branch;
if ($student->rejected == 1) {
unset($student->approved);
unset($student->books_issued);
$student->rejected = (bool) $student->rejected;
return $student;
}
if ($student->approved == 0) {
unset($student->rejected);
unset($student->books_issued);
$student->approved = (bool) $student->approved;
return $student;
}
unset($student->rejected);
unset($student->approved);
$student_issued_books = Logs::select('book_issue_id', 'issued_at')->where('student_id', '=', $id)->orderBy('time_stamp', 'desc')->take($student->books_issued)->get();
foreach ($student_issued_books as $issued_book) {
$issue = Issue::find($issued_book->book_issue_id);
$book = Books::find($issue->book_id);
$issued_book->name = $book->title;
$issued_book->issued_at = date('d-M', $issued_book->issued_at);
}
$student->issued_books = $student_issued_books;
return $student;
}
示例3: UpdateListBranch
public function UpdateListBranch()
{
$input = Input::all();
$listBranchID = $input['update_list_branch_id'];
$listBranchID = explode(",", $listBranchID);
foreach ($listBranchID as $p) {
if ($input['name'] != '') {
$branch = Branch::find($p);
$branch->name = $input['name'];
$branch->save();
}
}
}
示例4: aviso_renovar
public static function aviso_renovar()
{
$fecha_i = date('Y-m-d');
$fecha_f = Branch::find(Session::get('branch_id'))->deadline;
$dias = (strtotime($fecha_f) - strtotime($fecha_i)) / 86400;
if ($dias <= 5 && $dias >= 1) {
$mensaje = '<span class="label label-warning pull-right">Fecha Límite de Emisión expirará en ' . $dias . ' día(s).</span>';
return $mensaje;
} elseif ($dias == 0) {
$mensaje = '<span class="label label-danger pull-right">Su Fecha Límite de Emisión Expira Hoy.</span>';
return $mensaje;
}
return null;
}
示例5: all
public static function all($options = [])
{
$condition = (is_array($options) and $options['all']) ? '' : self::baseCondition();
$list = Branch::find($condition);
if ($list) {
$list = $list->toArray();
if (is_array($options) and $options['key']) {
$data = [];
foreach ($list as $row) {
$data[$row['bid']] = $row;
}
$list = $data;
}
return $list;
}
return [];
}
示例6: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->info('Search Delivery Items Life Time');
// 六十天提醒
//
$N_Time = date("Y-m-d", time());
$L_Time = date("Y-m-d", time() + 60 * 3600 * 24);
// 获取满足条件的货品
//
$Items = DeliveryItems::where('life_date', '>', $N_Time)->where('life_date', '<', $L_Time)->orderBy('delivery_id', 'desc')->get();
// 初始化
//
$branch_ids = array();
$delivery_ids = array();
foreach ($Items as $Item) {
// 条件过滤
//
if (!in_array($Item->delivery_id, $delivery_ids) && in_array($Item->branch_id, $branch_ids)) {
continue;
} else {
if (!in_array($Item->delivery_id, $delivery_ids)) {
$delivery_ids[] = $Item->delivery_id;
}
if (!in_array($Item->branch_id, $branch_ids)) {
$branch_ids[] = $Item->branch_id;
}
$branch = Branch::find($Item->branch_id);
$delivery = Delivery::find($Item->delivery_id);
if ($branch && $delivery) {
$notice = new Notice();
$notice->user_id = $branch->user_id;
$notice->type = '5';
$notice->content = '客户(' . $branch->name . ')的出货单(' . $delivery->bn . ')中商品(' . $Item->good_name . ')' . date("Y-m-d", strtotime($Item->life_date)) . ' 过期!';
$notice->data = json_encode(array('branch_id' => $Item->branch_id, 'delivery_id' => $Item->delivery_id));
$notice->read = '0';
$notice->timeline = date("Y-m-d H:i:s", time());
$notice->save();
$this->info($notice->content);
}
}
}
$this->info('Done!');
}
示例7: authenticate
/**
* Implementacja metody z interfejsu Zend_Auth_Adapter_Interface
* @see Zend_Auth_Adapter_Interface::authenticate()
* @return Zend_Auth_Result
*/
public function authenticate()
{
if (empty($this->_username)) {
throw new Zend_Auth_Adapter_Exception('Nie podano loginu!');
}
if (empty($this->_password)) {
throw new Zend_Auth_Adapter_Exception('Nie podano hasła!');
}
$config = Zend_Registry::get('config');
$this->_options = $config['ldap'];
$resultLDAP = parent::authenticate();
if ($resultLDAP->isValid()) {
$userModel = new User();
$userRow = $userModel->fetchRow(array('login = ?' => new Zend_Db_Expr("UPPER('{$this->_username}')"), 'ghost = ?' => 'f', 'is_locked = ?' => 'f', new Zend_Db_Expr('valid_until > NOW()')));
if ($userRow !== null) {
$identity = $this->_toStdClass($userRow);
unset($identity->password);
$ldapData = parent::getAccountObject();
$identity->ldap = $ldapData;
$branchModel = new Branch();
$identity->id_branch = ODDZIAL_ID;
$identity->view_branch = ODDZIAL_ID;
$data = $branchModel->find($identity->id_branch);
$d = $data->current()->toArray();
$d['application_code'] = 'getin';
$identity->jednostka = $d;
$identity->user_backend_apps_logins = null;
$identity->default_branches[$d['application_code']]['default_login'] = 'user';
$this->_authResult['code'] = Zend_Auth_Result::SUCCESS;
$this->_authResult['messages'] = 'Autoryzacja pomyślna.';
$this->_authResult['identity'] = $identity;
return $this->_createAuthResult();
} else {
$this->_authResult['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
$this->_authResult['messages'] = 'Konto nieaktywne lub zablokowane.';
return $this->_createAuthResult();
}
} else {
$this->_authResult['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
$this->_authResult['messages'] = 'Nieprawidłowe dane logowania.';
return $this->_createAuthResult();
}
}
示例8: unset
function _authenticateValidateResult($resultIdentity)
{
$zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match');
if ($resultIdentity[$zendAuthCredentialMatchColumn] != '1') {
$this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
$this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.';
return $this->_authenticateCreateAuthResult();
}
unset($resultIdentity[$zendAuthCredentialMatchColumn]);
$this->_resultRow = $resultIdentity;
// $userModel = new Logic_User();
// $user = $userModel->getUserByLogin();
$userModel = new User();
$user = $userModel->fetchRow(array('login = ?' => new Zend_Db_Expr("UPPER('" . $resultIdentity['login'] . "')"), 'ghost = ?' => 'f', 'is_locked = ?' => 'f', new Zend_Db_Expr('valid_until > NOW()')));
if (empty($user)) {
$this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
$this->_authenticateResultInfo['messages'][] = 'Authentication failed.';
return $this->_authenticateCreateAuthResult();
}
$identity = $this->_toStdClass($user);
$identity->password = $this->_password;
$branchModel = new Branch();
$identity->id_branch = ODDZIAL_ID;
$identity->view_branch = ODDZIAL_ID;
$data = $branchModel->find($identity->id_branch);
$d = $data->current()->toArray();
$d['application_code'] = 'getin';
$identity->jednostka = $d;
$identity->user_backend_apps_logins = null;
$identity->default_branches[$d['application_code']]['default_login'] = 'user';
//$identity->user_backend_apps_logins[$d['application_code']]['application_login'] = 'app_user';
$this->_authenticateResultInfo['identity'] = $identity;
$this->_resultRow = $user;
$this->_authenticateResultInfo['code'] = Zend_Auth_Result::SUCCESS;
$this->_authenticateResultInfo['messages'][] = 'Authentication successful.';
return $this->_authenticateCreateAuthResult();
}
示例9: saveLote
private function saveLote($factura)
{
$account = DB::table('accounts')->where('id', '=', Auth::user()->account_id)->first();
$branch = Branch::find(Session::get('branch_id'));
// return $factura['nit'];
$client = Client::where('account_id', '=', Auth::user()->account_id)->where('public_id', $factura['id'])->first();
//if(!$client)
// return $factura['nit'];
$invoice = Invoice::createNew();
$invoice->setPublicNotes($factura['nota']);
$invoice->setBranch(Session::get('branch_id'));
$invoice->setInvoiceDate(date("Y-m-d"));
$invoice->setClient($client->id);
$invoice->setEconomicActivity($branch->economic_activity);
$invoice->setDiscount(0);
$invoice->setClientName($client->name);
$invoice->setClientNit($client->nit);
$invoice->setUser(Auth::user()->id);
//$date=date("Y-m-d",strtotime(Input::get('invoice_date')));
//$invoice->setInvoiceDate($date);
$total_cost = 0;
foreach ($factura['products'] as $producto) {
//$pr = Product::where('account_id',Auth::user()->account_id)->where('product_key',$producto['product_key'])->first();
//$total_cost+= $pr->cost*$producto['qty'];
$total_cost += $producto['cost'];
}
$invoice->importe_neto = trim($total_cost);
$invoice->importe_total = trim($total_cost);
//$invoice->note = trim(Input::get('nota'));
$invoice->setAccountName($account->name);
$invoice->setAccountNit($account->nit);
$invoice->setBranchName($branch->name);
$invoice->setAddress1($branch->address1);
$invoice->setAddress2($branch->address2);
$invoice->setPhone($branch->work_phone);
$invoice->setCity($branch->city);
$invoice->setState($branch->state);
$invoice->setNumberAutho($branch->number_autho);
$invoice->setKeyDosage($branch->key_dosage);
$invoice->setTypeThird($branch->type_third);
$invoice->setDeadline($branch->deadline);
$invoice->setLaw($branch->law);
$type_document = TypeDocument::where('account_id', Auth::user()->account_id)->first();
$invoice->invoice_number = branch::getInvoiceNumber();
$numAuth = $invoice->number_autho;
$numfactura = $invoice->invoice_number;
$nit = $invoice->client_nit;
$fechaEmision = date("Ymd", strtotime($invoice->invoice_date));
$total = $invoice->importe_neto;
$llave = $branch->key_dosage;
$codigoControl = Utils::getControlCode($numfactura, $nit, $fechaEmision, $total, $numAuth, $llave);
$invoice->setControlCode($codigoControl);
$documents = TypeDocumentBranch::where('branch_id', $invoice->branch_id)->orderBy('id', 'ASC')->get();
foreach ($documents as $document) {
$actual_document = TypeDocument::where('id', $document->type_document_id)->first();
if ($actual_document->master_id == 1) {
$id_documento = $actual_document->id;
}
}
$invoice->setJavascript($id_documento);
$invoice->logo = 1;
$invoice->sfc = $branch->sfc;
//$invoice->qr =$invoice->account_nit.'|'.$invoice->invoice_number.'|'.$invoice->number_autho.'|'.$invoice->invoice_date.'|'.$invoice->importe_neto.'|'.$invoice->importe_total.'|'.$invoice->client_nit.'|'.$invoice->importe_ice.'|0|0|'.$invoice->descuento_total;
if ($account->is_uniper) {
$invoice->account_uniper = $account->uniper;
}
//$invoice->logo = $type_document->logo;
$invoice->save();
foreach ($factura['products'] as $producto) {
$product = Product::where('account_id', Auth::user()->account_id)->where('product_key', $producto['product_key'])->first();
if ($product != null) {
$invoiceItem = InvoiceItem::createNew();
$invoiceItem->setInvoice($invoice->id);
$invoiceItem->setProduct($product->id);
$invoiceItem->setProductKey($product->product_key);
$invoiceItem->setNotes($product->notes . " " . $producto['description']);
$invoiceItem->setCost($producto['cost']);
$invoiceItem->setQty(1);
$invoiceItem->save();
}
}
}
示例10: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$issue = Issue::find($id);
if ($issue == NULL) {
throw new Exception('Invalid Book ID');
}
$issue->added_at_timestamp = date('d-M-y h:i A', strtotime($issue->added_at_timestamp));
$book = Books::find($issue->book_id);
$issue->book_name = $book->title;
$issue->author = $book->author;
$issue->category = Categories::find($book->category_id)->category;
$issue->available_status = (bool) $issue->available_status;
if ($issue->available_status == 1) {
return $issue;
}
$conditions = array('return_time' => 0, 'book_issue_id' => $id);
$book_issue_log = Logs::where($conditions)->take(1)->get();
foreach ($book_issue_log as $log) {
$student_id = $log->student_id;
}
$student_data = Student::find($student_id);
unset($student_data->email_id);
unset($student_data->books_issued);
unset($student_data->approved);
unset($student_data->rejected);
$student_branch = Branch::find($student_data->branch)->branch;
$roll_num = $student_data->roll_num . '/' . $student_branch . '/' . substr($student_data->year, 2, 4);
unset($student_data->roll_num);
unset($student_data->branch);
unset($student_data->year);
$student_data->roll_num = $roll_num;
$student_data->category = StudentCategories::find($student_data->category)->category;
$issue->student = $student_data;
return $issue;
}
示例11: trans
<!--
<td>
<?php
if ($user->branch_id) {
$branch = Branch::find($user->branch_id);
if ($branch) {
echo $branch->name;
}
}
?>
</td>
-->
<td>
<?php
if ($user->branch_id) {
$branch = Branch::find($user->branch_id);
if ($branch && isset($branch->brand_id) && $branch->brand_id) {
$brand = Brand::find($branch->brand_id);
if ($brand) {
echo $brand->name;
}
}
}
?>
</td>
<td>
{{ $user->isActivated() ? trans('core::all.yes') : trans('core::all.no') }}
</td>
<td class="center" width="100">
<div>
@if($currentUser->hasAccess('update-user-info'))
示例12: getRecoverCapsuleList
public function getRecoverCapsuleList($BranchId, $GoodId)
{
$capsule = GoodCapsule::where('branch_id', $BranchId)->where('good_id', $GoodId)->orderBy('created_at', 'desc')->paginate();
return View::make('branch.recover-capsule-list')->with('branch', Branch::find($BranchId))->with('capsule', $capsule);
}
示例13: getWarehouseSelect
public function getWarehouseSelect($BranchId)
{
$branch = Branch::find($BranchId);
$warehouse = Warehouse::all();
return View::make('picking.warehouse-select')->with(compact('warehouse'))->with(compact('branch'));
}
示例14: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
if (Auth::user()->is_admin) {
$branch = Branch::find($id);
if ($branch->number_branch != 0) {
$branch->delete();
Session::flash('message', 'Se elimino satisfactoriamente a la sucursal');
} else {
Session::flash('error', 'No se puede eliminar a la casa matriz ');
}
return Redirect::to('sucursales');
}
return Redirect::to('inicio');
}
示例15: GetByAddress
public static function GetByAddress($branchAddress)
{
return Branch::find(array('address' => $branchAddress));
}