本文整理汇总了PHP中Tool::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Tool::find方法的具体用法?PHP Tool::find怎么用?PHP Tool::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: result
public function result(Request $request)
{
$this->validate($request, ['term' => 'required']);
$term = $request->term;
$currentPage = $request->get('page', 1);
$max = 12;
$from = $currentPage * $max - $max;
$to = $max;
$query = Tool::fuzzySearch('tools', 'serialnr', $term);
//Searchy::driver('fuzzy')->tools('serialn')->query($term)->get();
$collection = collect($query);
$total = count($query);
$result = $collection->splice($from, $to);
$pictures = array();
foreach ($result as $tool) {
$pictures[] = Tool::find($tool->id)->PreferredToolPicture();
}
$paginator = new LengthAwarePaginator($result, $total, $max, $currentPage);
$paginator->setPath('result');
return view('tool.search', compact('result', 'term', 'currentPage', 'total', 'max', 'paginator', 'pictures'));
}
示例2: tabItemAndCharacter
function tabItemAndCharacter($fighterId)
{
$tools = new Tool();
$t = $tools->find('all');
$datas = $this->read(null, $fighterId);
$posx = $datas['Fighter']['coordinate_x'];
$posy = $datas['Fighter']['coordinate_y'];
$final = array();
foreach ($t as $tt) {
$ttt = $tt['Tool'];
$x = $ttt['coordinate_x'];
$y = $ttt['coordinate_y'];
$final[$x][$y] = $ttt;
}
return $final;
}