当前位置: 首页>>代码示例>>PHP>>正文


PHP Team::limit方法代码示例

本文整理汇总了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'));
 }
开发者ID:Panfen,项目名称:mango,代码行数:27,代码来源:HomeController.php


注:本文中的app\Team::limit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。