<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Repository\Filter; use Illuminate\Support\Facades\Input; trait HasScopeFilter { protected $scopeFilters = array(); protected $scopeDefault = null; protected $scopeAddedParam = array(); public function scopeFilter($L4owo, $GjNrA, \Closure $aCnQE = null) { goto RrstS; eqkRD: return $this; goto HRHNl; RrstS: $udDBo = new ScopeFilter(); goto fbuRI; O0Fv8: array_push($this->scopeFilters, array('name' => $L4owo, 'title' => $GjNrA, 'filter' => $udDBo)); goto eqkRD; fbuRI: call_user_func($aCnQE, $udDBo); goto O0Fv8; HRHNl: } public function scopeDefault($L4owo) { $this->scopeDefault = $L4owo; return $this; } public function scopeParam() { goto abaHd; WQS2o: return array('_scope' => $G4CAd); goto Vyb4k; nEisK: if (null === $G4CAd) { return array(); } goto WQS2o; abaHd: $G4CAd = $this->scopeValue(); goto nEisK; Vyb4k: } public function scopeValue() { return Input::get('_scope', $this->scopeDefault); } public function scopeAddedParam($oK4I3 = null) { goto K9IOs; ak5_o: return $this; goto AqCgz; Y0DZF: $this->scopeAddedParam = $oK4I3; goto ak5_o; K9IOs: if (is_null($oK4I3)) { return $this->scopeAddedParam; } goto Y0DZF; AqCgz: } public function scopeExecuteQueries(&$hAzJ1) { goto aSC47; aSC47: $Sy8c5 = Input::get('_scope', $this->scopeDefault); goto HfcNm; HfcNm: if (empty($Sy8c5)) { return; } goto ZEgAD; ZEgAD: foreach ($this->scopeFilters as $zgXyr) { if ($zgXyr['name'] == $Sy8c5) { $udDBo = $zgXyr['filter']; $udDBo->executeQueries($hAzJ1); } } goto YBrj2; YBrj2: } }