38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Advert;
|
|
use App\Models\Article;
|
|
use App\Models\ArticlePicture;
|
|
use App\Models\Patent;
|
|
use Illuminate\Support\Arr;
|
|
|
|
class IndexController extends Controller
|
|
{
|
|
|
|
/**
|
|
* Notes: 首页
|
|
* @Author: 玄尘
|
|
* @Date : 2020/6/1 9:11
|
|
*/
|
|
public function index()
|
|
{
|
|
$data = [
|
|
'ysxw' => Article::where('category_id', 15)->latest('sort')->latest()->take(8)->get(),
|
|
// 'kjcg' => Article::where('category_id', 19)->latest('sort')->latest()->take(8)->get(),
|
|
// 'lwzl' => Patent::latest('sort')->latest()->take(11)->get(),
|
|
'center_advert' => Advert::latest('sort')->latest()->where('category_id', 23)->take(3)->get(),
|
|
'ysxw_right_advert' => Advert::latest('sort')->latest()->where('category_id', 24)->first(),
|
|
'kjcg_right_advert' => Advert::latest('sort')->latest()->where('category_id', 25)->take(2)->get(),
|
|
'lwzl_right_advert' => Advert::latest('sort')->latest()->where('category_id', 27)->take(2)->get(),
|
|
'pos_a' => Article::where('position', Article::POSITION_A)->first(),
|
|
'pos_b' => Article::where('position', Article::POSITION_B)->first(),
|
|
'pos_c' => Article::where('position', Article::POSITION_C)->first(),
|
|
];
|
|
|
|
return view('index.index', $data);
|
|
}
|
|
|
|
}
|