本文整理汇总了PHP中app\Member::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::paginate方法的具体用法?PHP Member::paginate怎么用?PHP Member::paginate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Member
的用法示例。
在下文中一共展示了Member::paginate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
/**
* 不分页, 取出全部数据
*/
// return view('admin.member.index')->withMembers(Member::all());
return view('admin.member.index')->withMembers(Member::paginate(30));
}
示例2: postMultipleCreate
public function postMultipleCreate(Request $request)
{
$excel = $request->file('watch');
$target = $excel->move(storage_path(), 'test.xslt');
\Excel::load($target, function ($reader) {
$array = $reader->get()->toArray();
$result = [];
foreach ($array as $item) {
if ($item[0]) {
$result[] = $item[0];
}
}
foreach ($result as $item) {
if ($member = Member::where('pid', intval($item))->first()) {
$member->fid = \Auth::user()->id;
$member->uname = \Auth::user()->contact_name;
$relative = Relative::where('mid', $member->id)->where('main', 1)->first();
if (!$relative) {
$relative = new Relative();
}
$relative->name = \Auth::user()->contact_name;
$relative->phone = \Auth::user()->contact_phone;
$relative->mid = $member->id;
$relative->main = 1;
$relative->save();
$member->save();
}
}
});
if (\Auth::user()->user_type == 0) {
$items = Member::paginate(10);
} else {
$items = Member::where('fid', '=', \Auth::user()->id)->paginate(10);
}
return view('watch.index')->with(['success' => true, 'items' => $items]);
}