first
This commit is contained in:
33
app/Http/Controllers/IndexController.php
Normal file
33
app/Http/Controllers/IndexController.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Advert;
|
||||
use App\Models\Article;
|
||||
use App\Models\Link;
|
||||
|
||||
class IndexController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Notes: 首页
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/6/1 9:11
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$adverts = Advert::where('category_id', 22)->get();
|
||||
$description = Article::find(255);
|
||||
$oneNews = Article::where('category_id', 7)->orderBy('created_at', 'desc')->first();
|
||||
$news = Article::where('category_id', 7)->where('id', '<', $oneNews->id)->orderBy('created_at', 'desc')->take(4)->get();
|
||||
$articles = Article::where('category_id', 19)->orderBy('created_at', 'desc')->take(4)->get();
|
||||
$prizes = Article::where('category_id', 20)->orderBy('created_at', 'desc')->take(8)->get();
|
||||
$patents = Article::where('category_id', 21)->orderBy('created_at', 'desc')->take(3)->get();
|
||||
$leaders = Article::where('category_id', 4)->take(3)->get();
|
||||
$simples = Article::where('category_id', 6)->take(6)->get();
|
||||
$links = Link::take(6)->get();
|
||||
|
||||
return view('index.index', compact('adverts', 'description', 'oneNews', 'news', 'articles', 'prizes', 'patents', 'leaders', 'simples', 'links'));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user