本文整理汇总了PHP中app\Team::limit方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::limit方法的具体用法?PHP Team::limit怎么用?PHP Team::limit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Team
的用法示例。
在下文中一共展示了Team::limit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$user = \Auth::user();
$time = $this->formatDate();
$action = 'home';
$r = Signin::where('user_id', \Auth::user()->id)->first();
$count = 0;
$signined = false;
if ($r) {
$count = $r['count'];
if (substr(Carbon::now(), 0, 10) == substr($r['last_signin'], 0, 10)) {
$signined = true;
}
}
$signinList = Signin::where('last_signin', 'like', substr(Carbon::now(), 0, 10) . '%')->orderBy('last_signin', 'desc')->get();
foreach ($signinList as &$item) {
$item['last_signin'] = substr($item['last_signin'], 11, 8);
}
$cates = Cate::orderBy('count', 'desc')->limit(6)->get();
$authors = User::orderBy('score', 'desc')->limit(6)->get();
$teams = Team::limit(3)->get();
$recommendedArticles = Article::orderBy('recommend', 'deac')->limit(4)->get();
$phpArticles = Article::where('cate_id', 1)->limit(5)->get();
$todayHotArticles = Article::where('published_at', '>=', Carbon::now()->subDay(1))->where('published_at', '<=', Carbon::now())->orderBy('view', 'deac')->limit(6)->get();
$weekHotArticles = Article::where('published_at', '>=', Carbon::now()->subDay(7))->where('published_at', '<=', Carbon::now())->orderBy('view', 'deac')->limit(6)->get();
return view('home', compact('user', 'time', 'action', 'signin', 'minus', 'count', 'signined', 'signinList', 'cates', 'authors', 'teams', 'recommendedArticles', 'phpArticles', 'todayHotArticles', 'weekHotArticles'));
}