本文整理匯總了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]);
}