本文整理汇总了PHP中Unit::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Unit::where方法的具体用法?PHP Unit::where怎么用?PHP Unit::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit::where方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
function index_delete()
{
$models = json_decode($this->delete('models'));
foreach ($models as $key => $value) {
$obj = new Unit(null, $this->entity);
$obj->where("id", $value->id)->get();
$data["results"][] = array("data" => $value, "status" => $obj->delete());
}
//Response data
$this->response($data, 200);
}
示例2: searchUnits
public function searchUnits()
{
if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin")) {
$view = View::make('Settings.Employees.settings_units');
$input = Input::all();
$keyword = !empty(trim($input["keyword"])) ? trim($input["keyword"]) : "";
$units = Unit::where("id", "=", $keyword)->orWhere("name", "LIKE", "%{$keyword}%")->orderBy("name")->paginate(25);
$view->units = $units;
$view->nav = "system";
$view->tab = "units";
$view->search = true;
Input::flash();
return $view;
} else {
return Redirect::to("/");
}
}
示例3: getSap
public function getSap($type, $no_sap)
{
$link = $this->link_dokumen($type, $no_sap);
$dokumen_with_pr = $link['dok_pr'];
$dokumen_with_po = $link['dok_po'];
$no_pr = $link['no_pr'];
$no_po = $link['no_po'];
$actifity_all = Actifity::all();
$sub_jenis_all = Sub_jenis_dokumen::all();
$unit_po = Unit::where('id', '=', 22)->orWhere('id', '=', 23)->orWhere('id', '=', 19)->orWhere('id', 25)->orWhere('id', 20)->get();
return view('dokumen.sap', compact('no_pr', 'no_po', 'dokumen', 'actifity_all', 'sub_jenis_all', 'dokumen_with_pr', 'dokumen_with_po', 'actifity_list', 'unit_po'));
}
示例4: processImport
//.........这里部分代码省略.........
$errorCount += 1;
$error[$rowIndex][$errorCount] = $errorCount . ". " . "Manager ID should be numeric." . "<br/>";
}
if (is_numeric($r->manager) && !Manager::find($r->manager)) {
$hasError = true;
//This will only matter if no errors has been found above.
$rowHasError = true;
//This will only matter if no errors has been found above.
$rowsWithErrors[$rowIndex] = $rowIndex;
//This will only matter if no errors has been found above.
$errorCount += 1;
$error[$rowIndex][$errorCount] = $errorCount . ". " . "Invalid manager ID." . "<br/>";
}
if (empty(trim($r->nsnid)) && !in_array(strtolower($r->status), array("academy", "ojt", "contractual", "graduate", "obsolete"))) {
$hasError = true;
//This will only matter if no errors has been found above.
$rowHasError = true;
//This will only matter if no errors has been found above.
$rowsWithErrors[$rowIndex] = $rowIndex;
//This will only matter if no errors has been found above.
$errorCount += 1;
$error[$rowIndex][$errorCount] = $errorCount . ". " . "The NSN ID is required." . "<br/>";
}
if (!empty($r->nsnid) && !is_numeric(trim($r->nsnid)) && !in_array($r->status, array("academy", "ojt", "contractual", "graduate", "obsolete"))) {
$hasError = true;
//This will only matter if no errors has been found above.
$rowHasError = true;
//This will only matter if no errors has been found above.
$rowsWithErrors[$rowIndex] = $rowIndex;
//This will only matter if no errors has been found above.
$errorCount += 1;
$error[$rowIndex][$errorCount] = $errorCount . ". " . "The NSN ID should be numeric." . "<br/>";
}
if (!empty($r->nsnid) && Employee::where("nsn_id", "=", $r->nsnid)->first()) {
$hasError = true;
//This will only matter if no errors has been found above.
$rowHasError = true;
//This will only matter if no errors has been found above.
$rowsWithErrors[$rowIndex] = $rowIndex;
//This will only matter if no errors has been found above.
$errorCount += 1;
$error[$rowIndex][$errorCount] = $errorCount . ". " . "NSN ID already exists." . "<br/>";
}
if (!empty($r->email) && !filter_var(trim($r->email), FILTER_VALIDATE_EMAIL)) {
$hasError = true;
//This will only matter if no errors has been found above.
$rowHasError = true;
//This will only matter if no errors has been found above.
$rowsWithErrors[$rowIndex] = $rowIndex;
//This will only matter if no errors has been found above.
$errorCount += 1;
$error[$rowIndex][$errorCount] = $errorCount . ". " . "Invalid e-mail address." . "<br/>";
}
if (is_numeric($r->businessline) && !BusinessLine::find($r->businessline)) {
$hasError = true;
//This will only matter if no errors has been found above.
$rowHasError = true;
//This will only matter if no errors has been found above.
$rowsWithErrors[$rowIndex] = $rowIndex;
//This will only matter if no errors has been found above.
$errorCount += 1;
$error[$rowIndex][$errorCount] = $errorCount . ". " . "Invalid Business Line ID." . "<br/>";
}
if (is_numeric($r->unit) && !Unit::find($r->unit)) {
$hasError = true;
//This will only matter if no errors has been found above.
示例5: filterUnits
public function filterUnits()
{
if ($this->hasAccess('admin')) {
$units = Unit::lists('name', 'id');
} elseif ($this->hasAccess('authorize')) {
$units = Unit::where('role_id', '=', $this->role_id)->lists('name', 'id');
} elseif ($this->hasAccess('request')) {
$units = Unit::where('id', '=', $this->unit_id)->lists('name', 'id');
}
return $units;
}