本文整理汇总了PHP中Branch::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::where方法的具体用法?PHP Branch::where怎么用?PHP Branch::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPostPage
public function getPostPage()
{
$obj = new BaseController();
$campusid = $this->getDevice();
if ($campusid == 0) {
$countryname = $obj->getCountryName();
if ($countryname == 'NONE') {
return Redirect::route('selectcampus-get');
} else {
//check whether the country name exists inthe db
$locationcountry = Country::where('name', '=', $countryname);
if ($locationcountry->count()) {
$locationcountrycode = $locationcountry->first()->code;
$locationcountrycode = strtolower($locationcountrycode);
return Redirect::route('selectcountryid', $locationcountrycode);
} else {
return Redirect::route('selectcampus-get');
}
}
}
$college = Institution::whereHas('Branch', function ($query) use($campusid) {
$query->where('id', '=', $campusid);
})->first();
View::share('college', $college);
$mycampus = Branch::where('id', '=', $campusid)->first();
View::share('mycampus', $mycampus);
if (Auth::user()) {
return View::make('member.post');
}
return View::make('guest.post');
}
示例2: buscar
public static function buscar($public_id)
{
if (Auth::check()) {
$account_id = Auth::user()->account_id;
} else {
$account_id = Session::get('account_id');
}
$branch = Branch::where('public_id', $public_id)->scope(false, $account_id)->first();
return $branch;
}
示例3: 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;
$productos = Account::find(Auth::user()->account_id)->products;
$informacionCuenta = array('sucursales' => sizeof($sucursales), 'usuarios' => sizeof($usuarios), 'clientes' => sizeof($clientes), 'productos' => sizeof($productos));
// return Response::json($informacionCuenta);
return View::make('cuentas.dashboard')->with('cuenta', $informacionCuenta);
}
示例4: getUpdate
public function getUpdate($business_id, $field, $value)
{
$first_branch = Branch::where('business_id', '=', $business_id)->first();
$first_service = Service::where('branch_id', '=', $first_branch->branch_id)->first();
if (QueueSettings::serviceExists($first_service->service_id)) {
QueueSettings::updateQueueSetting($first_service->service_id, $field, $value);
} else {
QueueSettings::createQueueSetting(['service_id' => $first_service->service_id, 'date' => mktime(0, 0, 0, date('m'), date('d'), date('Y')), $field => $value]);
}
return json_encode(['success' => 1]);
}
示例5: getIndex
public function getIndex()
{
if (Auth::user()->grade == 1) {
$branch = Branch::take(10)->get();
} else {
$branch = Branch::where('user_id', Auth::user()->id)->take(10)->get();
}
// 提醒
//
$notice = Notice::where('user_id', Auth::user()->id)->where('read', '0')->orderBy('timeline', 'desc')->take(10)->get();
return View::make('index')->with('goods', Good::orderBy('store')->take(10)->get())->with('branch', $branch)->with('notice', $notice);
}
示例6: getIndex
public function getIndex()
{
// 区域
//
$area = Area::all();
// 线路
//
$line = Line::all();
// 客户类型
//
$type = Type::all();
$whereRaw = ' 1=1 ';
$type_id = Input::get('type_id');
$area_id = Input::get('area_id');
$line_id = Input::get('line_id');
$name = Input::get('name');
$code = Input::get('code');
$contact = Input::get('contact');
if ($type_id) {
$whereRaw .= "and type_id = {$type_id} ";
}
if ($area_id) {
$whereRaw .= "and area_id = {$area_id} ";
}
if ($line_id) {
$whereRaw .= "and line_id = {$line_id} ";
}
if ($name) {
$whereRaw .= "and name like '%{$name}%' ";
}
if ($code) {
$whereRaw .= "and code like '%{$code}%' ";
}
if ($contact) {
$whereRaw .= "and contact like '%{$contact}%' ";
}
// 管理员
//
if (Auth::user()->grade == 10) {
$branch = Branch::where('user_id', Auth::user()->id)->whereRaw($whereRaw)->paginate();
$count = Branch::where('user_id', Auth::user()->id)->whereRaw($whereRaw)->count();
} else {
$branch = Branch::whereRaw($whereRaw)->paginate();
$count = Branch::whereRaw($whereRaw)->count();
}
return View::make('branch.index')->with(compact('area'))->with(compact('line'))->with(compact('type'))->with('branch', $branch)->with(compact('count'));
}
示例7: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($public_id)
{
if (Auth::user()->is_admin) {
$branch = Branch::where('id', $public_id)->first();
$documents = $this->getWorkingDocuments();
if ($branch->type_third == 0) {
$type = "Facturación Web";
}
if ($branch->type_third == 1) {
$type = "Facturación por Terceros";
}
if ($branch->type_third == 2) {
$type = "Facturación POS";
}
$data = ['sucursal' => $branch, 'documents' => $documents, 'type' => $type];
return View::make('sucursales.show', $data);
}
return Redirect::to('/inicio');
}
示例8: postImportEmp
public function postImportEmp()
{
if (\Request::ajax()) {
$efile = \Input::file('upload');
/* Validation of file */
$validate = \Validator::make(array('file' => $efile), array('file' => 'required|mimes:xls,csv|max:2000|min:1'));
if ($validate->fails()) {
$error = array('error' => $validate->messages()->first());
echo json_encode($error);
return;
} else {
$handle = file($efile->getRealPath());
/* Call Excel Class */
$objPHPExcel = \PHPExcel_IOFactory::load($efile->getRealPath());
$mainArr = array();
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
// Sheet names
switch ($worksheet->getTitle()) {
case 'User':
$index = 'users';
break;
case 'PersonalDetails':
$index = 'PersonalDetails';
break;
case 'ContactInfo':
$index = 'ContactInfo';
break;
case 'IdentificationandBankInfo':
$index = 'IdentificationandBankInfo';
break;
case 'PFandESIInformation':
$index = 'PFandESIInformation';
break;
case 'JobDetails':
$index = 'JobDetails';
break;
case 'EducationalBackground':
$index = 'EducationalBackground';
break;
case 'WorkExperience':
$index = 'WorkExperience';
break;
}
// Getting all cells
$subArr = array();
$rows = $worksheet->getRowIterator();
foreach ($rows as $row) {
$cells = $row->getCellIterator();
// cells store into data array
$data = array();
foreach ($cells as $cell) {
$data[] = $cell->getCalculatedValue();
}
if ($data) {
// one set of row stored in indexed array
$arr[$index] = $data;
// indexed array store into subarr
$subArr[] = $arr;
// remove indexd array for optimiced douplicated
unset($arr);
}
}
// every sheet of array store in main Arr
$mainArr[$index] = $subArr;
unset($subArr);
}
$emails = array_fetch($mainArr['users'], 'users.1');
// Validate emails
foreach ($emails as $value) {
if (preg_match("/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}\$/", $value)) {
} else {
$error = array('error' => "{$value} InValid Email");
echo json_encode($error);
return;
}
}
// validation email unique from excel
if (count($emails) != count(array_unique($emails))) {
$error = array('error' => "Douplicate emails are available");
echo json_encode($error);
return;
}
//end email unique in excel
//Check Email Id is unique or not
$user = \User::withTrashed()->whereIn('email', $emails)->first();
if ($user) {
$error = array('error' => "{$user->email} already registered");
echo json_encode($error);
return;
}
// Database insertion starts here
$users = $mainArr['users'];
$PersonalDetails = $mainArr['PersonalDetails'];
$ContactInfo = $mainArr['ContactInfo'];
$IdentificationandBankInfo = $mainArr['IdentificationandBankInfo'];
$PFandESIInformation = $mainArr['PFandESIInformation'];
$JobDetails = $mainArr['JobDetails'];
$EducationalBackground = $mainArr['EducationalBackground'];
$WorkExperience = $mainArr['WorkExperience'];
// Create UserId
//.........这里部分代码省略.........
示例9: factura2
public function factura2()
{
// return Response::json(Input::all());
$account = DB::table('accounts')->where('id', '=', Auth::user()->account_id)->first();
//$matriz = Branch::where('number_branch','=',0)->first();
$matriz = Branch::where('id', 2)->first();
$branch = Branch::where('id', '=', Session::get('branch_id'))->first();
$type_document = TypeDocument::where('account_id', Auth::user()->account_id)->where('master_id', Input::get('invoice_type'))->orderBy('id', 'DESC')->first();
if (Input::get('printer_type') == 1) {
$js = $type_document->javascript_web;
} else {
$js = $type_document->javascript_pos;
}
$client = Client::where('id', Input::get('client'))->first();
$invoice = (object) ['id' => '0', 'account_name' => $account->name, 'account_nit' => $account->nit, 'account_uniper' => $account->uniper, 'address1' => $branch->address1, 'address2' => $branch->address2, 'terms' => Input::get('terms'), 'importe_neto' => Input::get('total'), 'importe_total' => Input::get('subtotal'), 'discount' => number_format(Input::get('subtotal') - Input::get('total'), 2, '.', ''), 'importe_ice' => number_format(Input::get('importe_ice'), 2, '.', ''), 'debito_fiscal' => number_format(Input::get('importe_fiscal'), 2, '.', ''), 'branch_name' => $branch->name, 'city' => $branch->city, 'client_id' => Input::get('client'), 'client_name' => Input::get('nombre'), 'client_nit' => Input::get('nit'), 'control_code' => '00-00-00-00', 'deadline' => $branch->deadline, 'descuento_total' => Input::get('discount'), 'economic_activity' => $branch->economic_activity, 'end_date' => Input::get('due_date'), 'invoice_date' => Input::get('invoice_date'), 'invoice_number' => 0, 'number_autho' => $branch->number_autho, 'phone' => $branch->work_phone, 'public_notes' => Input::get('public_notes'), 'logo' => $type_document->logo, 'sfc' => $branch->sfc, 'type_third' => $branch->type_third, 'branch_id' => $branch->id, 'state' => $branch->state, 'law' => $branch->law, 'javascript' => $js, 'document_number' => 0, 'extralabel' => $client->custom_value1];
// $document= TypeDocument::where("id",$invoice->javascript)->first();
// $invoice->logo = $document->logo;
// $invoice->javascript = $invoice->logo?$document->javascript_web:$document->javascript_pos;
$user = Auth::user();
$products = array();
foreach (Input::get('productos') as $producto) {
$product = Product::where('account_id', Auth::user()->account_id)->where('product_key', $producto["'product_key'"])->first();
if ($product != null) {
$prod = (object) ['product_key' => $producto["'product_key'"], 'notes' => $product->notes, 'cost' => $producto["'cost'"], 'qty' => $producto["'qty'"] + $product->units * $producto["'pack'"], 'packs' => $producto["'qty'"] / $product->units + $producto["'pack'"]];
array_push($products, $prod);
}
}
// $invoice = Input::all();
$template = TypeDocumentBranch::where('branch_id', $invoice->branch_id)->select('template')->first();
//return 0;
$data = array('invoice' => $invoice, 'account' => $account, 'products' => $products, 'copia' => 0, 'matriz' => $matriz, 'user' => $user, 'template' => $template);
// if(Input::get('printer_type')==0)
// return View::make('factura.ver2',$data);
return View::make('factura.ver', $data);
}
示例10: do_select_branch
public function do_select_branch()
{
if (Input::get('branch_id')) {
$branch_id = Input::get('branch_id');
$branch = Branch::where('account_id', '=', Auth::user()->account_id)->where('public_id', $branch_id)->first();
$user = Auth::user();
$user->branch_id = $branch->id;
$user->save();
return Redirect::intended('/');
}
}
示例11: save
private function save($publicId = null)
{
$action = Input::get('action');
$entityType = Input::get('entityType');
if ($action == 'archive' || $action == 'delete' || $action == 'mark') {
return InvoiceController::bulk($entityType);
}
$input = json_decode(Input::get('data'));
$invoice = $input->invoice;
if (Utils::isAdmin()) {
$branch_id = $input->invoice->branch_id;
$branch = Branch::where('account_id', '=', Auth::user()->account_id)->where('public_id', $branch_id)->first();
// $branch = DB::table('branches')->where('id',$branch_id)->first();
} else {
$branch = Auth::user()->branch;
$branch_id = $branch->id;
$branch = DB::table('branches')->where('id', $branch_id)->first();
}
$today = new DateTime('now');
$today = $today->format('Y-m-d');
$datelimit = DateTime::createFromFormat('Y-m-d', $branch->deadline);
$datelimit = $datelimit->format('Y-m-d');
$valoresPrimera = explode("-", $datelimit);
$valoresSegunda = explode("-", $today);
$diaPrimera = $valoresPrimera[2];
$mesPrimera = $valoresPrimera[1];
$anyoPrimera = $valoresPrimera[0];
$diaSegunda = $valoresSegunda[2];
$mesSegunda = $valoresSegunda[1];
$anyoSegunda = $valoresSegunda[0];
$a = gregoriantojd($mesPrimera, $diaPrimera, $anyoPrimera);
$b = gregoriantojd($mesSegunda, $diaSegunda, $anyoSegunda);
$errorS = "Expiró la fecha límite de " . $branch->name;
if ($a - $b < 0) {
Session::flash('error', $errorS);
return Redirect::to("{$entityType}s/create")->withInput();
} else {
$last_invoice = Invoice::where('account_id', '=', Auth::user()->account_id)->first();
if ($last_invoice) {
$yesterday = $last_invoice->invoice_date;
$today = date("Y-m-d", strtotime($invoice->invoice_date));
$errorD = "La fecha de la factura es incorrecta";
$yesterday = new DateTime($yesterday);
$today = new DateTime($today);
if ($yesterday > $today) {
Session::flash('error', $errorD);
return Redirect::to("{$entityType}s/create")->withInput();
}
}
if ($errors = $this->invoiceRepo->getErrors($invoice)) {
Session::flash('error', trans('texts.invoice_error'));
return Redirect::to("{$entityType}s/create")->withInput()->withErrors($errors);
} else {
$this->taxRateRepo->save($input->tax_rates);
$clientData = (array) $invoice->client;
$clientData['branch'] = $branch->id;
$client = $this->clientRepo->save($invoice->client->public_id, $clientData);
$invoiceData = (array) $invoice;
$invoiceData['branch_id'] = $branch->id;
$invoiceData['client_id'] = $client->id;
$invoiceData['client_nit'] = $client->nit;
$invoiceData['client_name'] = $client->name;
$invoiceData['action'] = $action;
$invoice = $this->invoiceRepo->save($publicId, $invoiceData, $entityType);
$account = Auth::user()->account;
// if ($account->invoice_taxes != $input->invoice_taxes
// || $account->invoice_item_taxes != $input->invoice_item_taxes
// || $account->invoice_design_id != $input->invoice->invoice_design_id)
// {
// $account->invoice_taxes = $input->invoice_taxes;
// $account->invoice_item_taxes = $input->invoice_item_taxes;
// $account->invoice_design_id = $input->invoice->invoice_design_id;
// $account->save();
// }
$client->load('contacts');
$sendInvoiceIds = [];
foreach ($client->contacts as $contact) {
if ($contact->send_invoice || count($client->contacts) == 1) {
$sendInvoiceIds[] = $contact->id;
}
}
foreach ($client->contacts as $contact) {
$invitation = Invitation::scope()->whereContactId($contact->id)->whereInvoiceId($invoice->id)->first();
if (in_array($contact->id, $sendInvoiceIds) && !$invitation) {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $contact->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
} else {
if (!in_array($contact->id, $sendInvoiceIds) && $invitation) {
$invitation->delete();
}
}
}
$invoice_date = date("d/m/Y", strtotime($invoice->invoice_date));
require_once app_path() . '/includes/BarcodeQR.php';
// $ice = $invoice->amount-$invoice->fiscal;
$desc = $invoice->subtotal - $invoice->amount;
$subtotal = number_format($invoice->subtotal, 2, '.', '');
//.........这里部分代码省略.........
示例12: mapFileInvoice
private function mapFileInvoice()
{
$file = Input::file('file');
if ($file == null) {
Session::flash('error', trans('texts.select_file'));
return Redirect::to('company/import_export');
}
$name = $file->getRealPath();
require_once app_path() . '/includes/parsecsv.lib.php';
$csv = new parseCSV();
$csv->heading = false;
$csv->auto($name);
Session::put('data', $csv->data);
$headers = false;
$hasHeaders = false;
$mapped = array();
$columns = array('', Invoice::$fieldCodClient, Invoice::$fieldProduct, Invoice::$fieldAmount);
if (count($csv->data) > 0) {
$headers = $csv->data[0];
foreach ($headers as $title) {
if (strpos(strtolower($title), 'name') > 0) {
$hasHeaders = true;
break;
}
}
for ($i = 0; $i < count($headers); $i++) {
$title = strtolower($headers[$i]);
$mapped[$i] = '';
if ($hasHeaders) {
$map = array('cod_client' => Invoice::$fieldCodClient, 'product' => Invoice::$fieldProduct, 'amount' => Invoice::$fieldAmount);
foreach ($map as $search => $column) {
foreach (explode("|", $search) as $string) {
if (strpos($title, 'sec') === 0) {
continue;
}
if (strpos($title, $string) !== false) {
$mapped[$i] = $column;
break 2;
}
}
}
}
}
}
$data = array('data' => $csv->data, 'headers' => $headers, 'hasHeaders' => $hasHeaders, 'columns' => $columns, 'mapped' => $mapped);
$data['branches'] = Branch::where('account_id', '=', Auth::user()->account_id)->orderBy('id')->get();
return View::make('accounts.import_map_invoice', $data);
}
示例13: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
\DB::beginTransaction();
$branch = \Branch::where('id', '=', $id)->with('contact')->firstOrFail();
$user = \User::where('id', '=', $branch->user_id)->firstOrFail();
$contact = \BranchContact::where('branch_id', '=', $id)->firstOrFail();
// $branchEmp=\BranchEmp::where('branch_id','=',$id)->firstOrFail();
if (!$user->delete()) {
\DB::rollback();
return \Redirect::back()->with('error', 'Failed to delete');
}
if (!$branch->delete()) {
\DB::rollback();
return \Redirect::back()->with('error', 'Failed to delete');
}
if (!$contact->delete()) {
\DB::rollback();
return \Redirect::back()->with('error', 'Failed to delete');
} else {
\DB::commit();
return \Redirect::back()->with('success', 'Successfully deleted');
}
}
示例14: getMoreHomePageSqueeb
public function getMoreHomePageSqueeb($lastid)
{
$campusid = $this->getDevice();
$obj = new BaseController();
$campusid = $this->getDevice();
if ($campusid == 0) {
$countryname = $obj->getCountryName();
if ($countryname == 'NONE') {
return Redirect::route('selectcampus-get');
} else {
//check whether the country name exists inthe db
$locationcountry = Country::where('name', '=', $countryname);
if ($locationcountry->count()) {
$locationcountrycode = $locationcountry->first()->code;
$locationcountrycode = strtolower($locationcountrycode);
return Redirect::route('selectcountryid', $locationcountrycode);
} else {
return Redirect::route('selectcampus-get');
}
}
}
$more = true;
$college = Institution::whereHas('Branch', function ($query) use($campusid) {
$query->where('id', '=', $campusid);
})->first();
$collegeid = $college->id;
$countryid = Country::where('id', '=', $college->country_id)->first()->id;
//get the top squeeb to display
$newsqueebs = Squeeb::where('active', '=', TRUE)->where('branch_id', '=', $campusid)->orderBy('id', 'DESC')->take(self::TOP_SQUEEB_LIMIT)->get();
View::share('newsqueebs', $newsqueebs);
$squeebs = Notice::whereHas('Squeeb', function ($query) use($campusid, $lastid) {
$query->where('branch_id', '=', $campusid)->where('id', '<', $lastid)->where('active', '=', TRUE);
})->orwhereHas('Squeeb', function ($query) use($lastid) {
$query->where('branch_id', '=', 0)->where('world', '=', TRUE)->where('id', '<', $lastid)->where('active', '=', TRUE);
})->orwhereHas('Squeeb', function ($query) use($lastid, $countryid) {
$query->where('branch_id', '=', 0)->where('country', '=', $countryid)->where('id', '<', $lastid)->where('active', '=', TRUE);
})->orwhereHas('Squeeb', function ($query) use($lastid, $collegeid) {
$query->where('branch_id', '=', 0)->where('college', '=', $collegeid)->where('id', '<', $lastid)->where('active', '=', TRUE);
});
$last = $squeebs;
$squeebs = $squeebs->orderBy('id', 'DESC')->take(self::SQUEEB_LIMIT)->get();
if ($squeebs->count()) {
$last_id = $last->orderBy('id', 'DESC')->take(self::SQUEEB_LIMIT)->get()->last()->Squeeb()->first()->id;
}
View::share('last_id', $last_id);
View::share('squeebs', $squeebs);
//get the top squeeb to display
$topsqueebs = Squeeb::where('active', '=', TRUE)->where('model', '=', 'Notice')->where('branch_id', '=', $campusid)->orderBy('views', 'DESC')->take(self::TOP_SQUEEB_LIMIT)->get();
View::share('topsqueebs', $topsqueebs);
if ($lastid <= 0 or $squeebs->count() != self::SQUEEB_LIMIT) {
$more = false;
}
$college = Institution::whereHas('Branch', function ($query) use($campusid) {
$query->where('id', '=', $campusid);
})->first();
View::share('college', $college);
View::share('more', $more);
$mycampus = Branch::where('id', '=', $campusid)->first();
View::share('mycampus', $mycampus);
return View::make('guest.home');
}
示例15: loginpos
public function loginpos()
{
// $branch = DB::table('branches')->where('id','=',$user->branch_id)->first();
// $clients = DB::table('clients')->select('id','name','nit')->where('account_id',$user->account_id)->get(array('id','name','nit'));
// $account = DB::table('accounts')->where('id',$user->account_id) ->first();
$products = DB::table('products')->where('account_id', '=', Auth::user()->account_id)->get(array('id', 'product_key', 'notes', 'cost'));
// $ice = DB::table('tax_rates')->select('rate')
// // ->where('account_id','=',$user->account_id)
// ->where('name','=','ice')
// ->first();
// if(Auth::user()->is_admin){
$branches = Branch::where('account_id', Auth::user()->account_id)->select('id', 'name')->get();
// }else
// {
// }
$mensaje = array('productos' => $products, 'sucursales' => $branches);
return Response::json($mensaje);
}