Files
new_haai/app/Http/Controllers/IndexController.php
2021-12-21 13:31:06 +08:00

43 lines
1.7 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::ByCategory(15)
->where('status', 1)
->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)->where('status', 1)->first(),
'pos_b' => Article::where('position', Article::POSITION_B)->where('status', 1)->first(),
'pos_c' => Article::where('position', Article::POSITION_C)->where('status', 1)->first(),
];
return view('index.index', $data);
}
}