本文整理汇总了PHP中Branch::scope方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::scope方法的具体用法?PHP Branch::scope怎么用?PHP Branch::scope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::scope方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: archive
public function archive($publicId)
{
$branch = Branch::scope($publicId)->firstOrFail();
$branch->delete();
Session::flash('message', trans('texts.archived_branch'));
return Redirect::to('company/branches');
}
示例2: getViewModel
private static function getViewModel()
{
return ['account' => Auth::user()->account, 'branch' => Auth::user()->branch, 'matriz' => Branch::scope(1)->firstOrFail(), 'products' => DB::table('invoice_items')->where('invoice_id', '=', 1)->get(), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::orderBy('name')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels(), 'frequencies' => array(1 => 'Semanal', 2 => 'Cada 2 semanas', 3 => 'Cada 4 semanas', 4 => 'Mensual', 5 => 'Trimestral', 6 => 'Semestral', 7 => 'Anual')];
}
示例3: 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);
}
示例4: getDatatable
public function getDatatable()
{
if (Utils::isAdmin()) {
$clients = $this->clientRepo->find(Input::get('sSearch'));
return Datatable::query($clients)->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('public_id', function ($model) {
return link_to('clients/' . $model->public_id, $model->public_id);
})->addColumn('nit', function ($model) {
return link_to('clients/' . $model->public_id, $model->nit);
})->addColumn('name', function ($model) {
return link_to('clients/' . $model->public_id, $model->name);
})->addColumn('first_name', function ($model) {
return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name);
})->addColumn('created_at', function ($model) {
return Utils::timestampToDateString(strtotime($model->created_at));
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . URL::to('clients/' . $model->public_id . '/edit') . '">' . trans('texts.edit_client') . '</a></li>
<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_client') . '</a></li>
</ul>
</div>';
})->make();
}
if (!Utils::isAdmin()) {
$clients = $this->clientRepo->find(Input::get('sSearch'));
global $uss;
$branch = Branch::scope()->firstOrFail();
$uss = $branch->deadline;
if (time() - 60 * 60 * 24 < strtotime($branch->deadline)) {
$uss = true;
} else {
$uss = false;
}
global $enfecha;
$enfecha = $uss;
return Datatable::query($clients)->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('public_id', function ($model) {
return link_to('clients/' . $model->public_id, $model->public_id);
})->addColumn('nit', function ($model) {
return link_to('clients/' . $model->public_id, $model->nit);
})->addColumn('name', function ($model) {
return link_to('clients/' . $model->public_id, $model->name);
})->addColumn('first_name', function ($model) {
return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name);
})->addColumn('created_at', function ($model) {
return Utils::timestampToDateString(strtotime($model->created_at));
})->addColumn('dropdown', function ($model) {
$return1 = '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a class="enviar_class" ';
//$return2=($enfecha?'href="' . URL::to('invoices/create/'.$model->public_id) . '">':' onclick="cancel()" href="#"'. '">');
global $enfecha;
global $uss;
if ($enfecha) {
$return2 = 'href="' . URL::to('invoices/create/' . $model->public_id) . '">';
} else {
$return2 = 'data-toggle="modal" data-target="#myModal" href="#">';
}
$return3 = trans('texts.new_invoice') . '</a></li>
<li class="divider"></li>
<li><a href="' . URL::to('clients/' . $model->public_id . '/edit') . '">' . trans('texts.edit_client') . '</a></li>
<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_client') . '</a></li>
</ul>
</div>';
return $return1 . $return2 . $return3;
})->make();
}
}