我也不知道自己调了什么
This commit is contained in:
@@ -67,7 +67,7 @@ class IndexController extends AdminController
|
||||
->removable()
|
||||
->uniqueName();
|
||||
|
||||
$form->ueditor('content', '文章内容')->rules('required', ['required' => '详情不能为空']);
|
||||
$form->ueditor('content', '文章内容');
|
||||
$form->number('sort', '序号')->default(0)->rules('required', ['required' => '序号必须填写'])->help('倒序优先');
|
||||
$form->switch('status', '状态')->default(1);
|
||||
$form->text('url', '外链地址');
|
||||
|
||||
48
app/Admin/Controllers/Article/TalentController.php
Normal file
48
app/Admin/Controllers/Article/TalentController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers\Article;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\Patent;
|
||||
use App\Models\Talent;
|
||||
use Encore\Admin\Controllers\AdminController;
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Grid;
|
||||
|
||||
class TalentController extends AdminController
|
||||
{
|
||||
|
||||
protected $title = '领军人才梯队';
|
||||
|
||||
public function grid()
|
||||
{
|
||||
$grid = new Grid(new Talent());
|
||||
$grid->model()->latest('sort');
|
||||
$grid->column('id', '#ID#');
|
||||
$grid->column('sort', '排序(倒序显示)')->editable();
|
||||
$grid->column('title', '梯队名称');
|
||||
$grid->column('leader', '带头人');
|
||||
$grid->column('unleader', '后备带头人');
|
||||
$grid->column('created_at', '创建时间');
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
$form = new Form(new Talent());
|
||||
|
||||
$form->text('title', '梯队名称')->required();
|
||||
$form->image('cover', '封面')
|
||||
->move('images/' . date('Y/m/d'))
|
||||
->removable()
|
||||
->uniqueName();
|
||||
$form->text('leader', '带头人')->required();
|
||||
$form->text('unleader', '后备带头人')->required();
|
||||
// $form->textarea('members', '梯队成员')->required();
|
||||
$form->textarea('description', '梯队介绍')->required();
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,4 +9,5 @@ Route::group([
|
||||
], function (Router $router) {
|
||||
$router->resource('articles', 'IndexController');
|
||||
$router->resource('patents', 'PatentController');
|
||||
$router->resource('talents', 'TalentController');
|
||||
});
|
||||
|
||||
@@ -4,6 +4,8 @@ use App\Models\Advert;
|
||||
use App\Models\Category;
|
||||
use App\Models\Article;
|
||||
use App\Models\Patent;
|
||||
use App\Models\Talent;
|
||||
use Encore\Admin\Auth\Database\Menu;
|
||||
|
||||
function getOneCategory($categoryId, $return = '')
|
||||
{
|
||||
@@ -23,8 +25,8 @@ function getOneCategory($categoryId, $return = '')
|
||||
* Notes: 获取文章分类详情
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/9/10 13:21
|
||||
* @param $categoryId
|
||||
* @param string $result
|
||||
* @param $categoryId
|
||||
* @param string $result
|
||||
* @return \App\Models\Article
|
||||
*/
|
||||
function getOneArticleBYCate($categoryId, $result = '')
|
||||
@@ -109,3 +111,26 @@ function getOneAdvert($category_id, $value = '')
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
//获取人才数据
|
||||
function getAllTalent()
|
||||
{
|
||||
return Talent::latest('sort')->get();
|
||||
}
|
||||
|
||||
//获取一篇人才文章
|
||||
function getOneRenById($article_id)
|
||||
{
|
||||
return Talent::find($article_id);
|
||||
}
|
||||
|
||||
//获取分类信息
|
||||
function getCate($id, $value = '')
|
||||
{
|
||||
$info = Menu::find($id);
|
||||
if ($value) {
|
||||
return $info->{$value};
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class CategoryController extends Controller
|
||||
$parent = getTopCate($category->id);
|
||||
|
||||
$template = array_flip(config('haai.category'));
|
||||
if (isset($template[$category->id])) {
|
||||
if (isset($template[$category->id]) && !in_array($category->id, config('haai.no_list'))) {
|
||||
return view('category.' . $template[$category->id], compact('category', 'parent'));
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class CategoryController extends Controller
|
||||
$take = 16;
|
||||
$template = 'category.persons';
|
||||
}
|
||||
|
||||
|
||||
$articles = Article::where('category_id', $category->id)
|
||||
->where('status', 1)
|
||||
->latest('sort')
|
||||
@@ -46,6 +46,10 @@ class CategoryController extends Controller
|
||||
|
||||
$parent = getTopCate($category->id);
|
||||
|
||||
if (in_array($category->id, [55, 54]) && $category->children->isEmpty()) {
|
||||
$parent = $category->parent;
|
||||
}
|
||||
|
||||
return view($template, compact('category', 'parent', 'articles'));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class IndexController extends Controller
|
||||
|
||||
$data = [
|
||||
'ysxw' => Article::where('category_id', 15)->latest('sort')->latest()->take(8)->get(),
|
||||
'kjcg' => Article::where('category_id', 20)->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(),
|
||||
|
||||
11
app/Models/Talent.php
Normal file
11
app/Models/Talent.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Traits\HasOneCover;
|
||||
|
||||
class Talent extends Model
|
||||
{
|
||||
|
||||
use HasOneCover;
|
||||
}
|
||||
Reference in New Issue
Block a user