阶段更新
This commit is contained in:
@@ -55,14 +55,19 @@ class IndexController extends AdminController
|
||||
$form->belongsToMany('categories', CategorySelectAble::class, __('关联分类'));
|
||||
$form->textarea('description', '内容简介');
|
||||
|
||||
$form->list('subjoin', '附加')
|
||||
->help('只有领导班子需要添加');
|
||||
// $form->list('subjoin', '附加')
|
||||
// ->help('只有领导班子需要添加');
|
||||
|
||||
$form->image('cover', '封面')
|
||||
->move('images/'.date('Y/m/d'))
|
||||
->removable()
|
||||
->uniqueName();
|
||||
|
||||
$form->image('label', '图标')
|
||||
->move('images/'.date('Y/m/d'))
|
||||
->removable()
|
||||
->uniqueName();
|
||||
|
||||
$form->multipleImage('pictures', '多图')
|
||||
->move('images/'.date('Y/m/d'))
|
||||
->removable()
|
||||
|
||||
@@ -34,7 +34,7 @@ class CategoryController extends Controller
|
||||
$parent = $category->parent;
|
||||
}
|
||||
|
||||
$articles = Article::ByCategory($category->getAllChildrenId())
|
||||
$articles = Article::shown()->ByCategory($category->getAllChildrenId())
|
||||
->where('status', 1)
|
||||
->Bysort()
|
||||
->paginate();
|
||||
@@ -47,7 +47,7 @@ class CategoryController extends Controller
|
||||
];
|
||||
|
||||
if ($category->id == 2) {
|
||||
$article = Article::query()->ByCategory(2)->Bysort()->first();
|
||||
$article = Article::shown()->ByCategory(2)->Bysort()->first();
|
||||
$data = array_merge($data, [
|
||||
'article' => $article,
|
||||
]);
|
||||
@@ -57,9 +57,9 @@ class CategoryController extends Controller
|
||||
$cgCate = Category::find(24);
|
||||
$hjCate = Category::find(20);
|
||||
$zlCate = Category::find(21);
|
||||
$cgArticles = Article::query()->ByCategory($cgCate->id)->Bysort()->take(3)->get();
|
||||
$hjArticles = Article::query()->ByCategory($hjCate->id)->Bysort()->take(3)->get();
|
||||
$zlArticles = Article::query()->ByCategory($zlCate->id)->Bysort()->take(6)->get();
|
||||
$cgArticles = Article::shown()->ByCategory($cgCate->id)->Bysort()->take(3)->get();
|
||||
$hjArticles = Article::shown()->ByCategory($hjCate->id)->Bysort()->take(3)->get();
|
||||
$zlArticles = Article::shown()->ByCategory($zlCate->id)->Bysort()->take(6)->get();
|
||||
|
||||
$data = array_merge($data, [
|
||||
'cgCate' => $cgCate,
|
||||
@@ -72,7 +72,7 @@ class CategoryController extends Controller
|
||||
}
|
||||
|
||||
if ($category->id == 3) {
|
||||
$articles = Article::ByCategory($category->getAllChildrenId())
|
||||
$articles = Article::shown()->ByCategory($category->getAllChildrenId())
|
||||
->where('status', 1)
|
||||
->Bysort()
|
||||
->get();
|
||||
@@ -87,9 +87,9 @@ class CategoryController extends Controller
|
||||
$nyydtCate = Category::find(7);
|
||||
$mtbdCate = Category::find(31);
|
||||
|
||||
$tzArticles = Article::query()->ByCategory($tzCate->id)->Bysort()->take(4)->get();
|
||||
$nyydtArticles = Article::query()->ByCategory($nyydtCate->id)->Bysort()->take(3)->get();
|
||||
$mtbdArticles = Article::query()->ByCategory($mtbdCate->id)->Bysort()->take(3)->get();
|
||||
$tzArticles = Article::shown()->ByCategory($tzCate->id)->Bysort()->take(4)->get();
|
||||
$nyydtArticles = Article::shown()->ByCategory($nyydtCate->id)->Bysort()->take(3)->get();
|
||||
$mtbdArticles = Article::shown()->ByCategory($mtbdCate->id)->Bysort()->take(3)->get();
|
||||
$data = array_merge($data, [
|
||||
'tzCate' => $tzCate,
|
||||
'nyydtCate' => $nyydtCate,
|
||||
@@ -105,8 +105,8 @@ class CategoryController extends Controller
|
||||
$zdCate = Category::find(16);
|
||||
$ljCate = Category::find(29);
|
||||
|
||||
$yjArticles = Article::query()->ByCategory($yjCate->id)->Bysort()->take(3)->get();
|
||||
$ljLeaders = Leader::query()->where('category_id', $ljCate->id)->Bysort()->take(3)->get();
|
||||
$yjArticles = Article::shown()->ByCategory($yjCate->id)->Bysort()->take(3)->get();
|
||||
$ljLeaders = Leader::shown()->where('category_id', $ljCate->id)->Bysort()->take(3)->get();
|
||||
$data = array_merge($data, [
|
||||
'yjCate' => $yjCate,
|
||||
'zdCate' => $zdCate,
|
||||
@@ -118,9 +118,14 @@ class CategoryController extends Controller
|
||||
|
||||
if ($category->id == 32) {
|
||||
|
||||
$nghjxhArticle = Article::query()->ByCategory($category->id)->Bysort()->first();
|
||||
$data = array_merge($data, [
|
||||
$nghjxhArticle = Article::shown()->ByCategory($category->id)->Bysort()->first();
|
||||
$xhdtCate = Category::find(33);
|
||||
$xhdtArticles = Article::shown()->ByCategory($xhdtCate->id)->Bysort()->get();
|
||||
|
||||
$data = array_merge($data, [
|
||||
'nghjxhArticle' => $nghjxhArticle,
|
||||
'xhdtCate' => $xhdtCate,
|
||||
'xhdtArticles' => $xhdtArticles,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class StaffController extends Controller
|
||||
$parent = $category->parent;
|
||||
}
|
||||
|
||||
$staffs = Staff::query()->latest('order')->get();
|
||||
$staffs = Staff::shown()->latest('order')->get();
|
||||
|
||||
$data = [
|
||||
'staffs' => $staffs,
|
||||
|
||||
@@ -4,12 +4,13 @@ namespace App\Models;
|
||||
|
||||
use App\Models\Traits\HasCovers;
|
||||
use App\Models\Traits\HasSort;
|
||||
use App\Models\Traits\ScopeStatus;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Article extends Model
|
||||
{
|
||||
|
||||
use HasCovers,HasSort;
|
||||
use HasCovers, HasSort, ScopeStatus;
|
||||
|
||||
/**
|
||||
* 应进行类型转换的属性
|
||||
@@ -59,16 +60,40 @@ class Article extends Model
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 获取时间 天
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2022/6/30 10:33
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDateD()
|
||||
{
|
||||
return $this->created_at->format('d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取时间 年月
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2022/6/30 10:33
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDateYM()
|
||||
{
|
||||
return $this->created_at->format('Y-m');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes : 解析单图地址
|
||||
*
|
||||
* @Date : 2021/3/16 4:54 下午
|
||||
* @Author : <Jason.C>
|
||||
* @return string
|
||||
*/
|
||||
public function getLabelUrlAttribute(): string
|
||||
{
|
||||
return $this->parseImageUrl($this->label);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,12 +5,14 @@ namespace App\Models;
|
||||
use App\Models\Traits\BelongsToCategory;
|
||||
use App\Models\Traits\HasCovers;
|
||||
use App\Models\Traits\HasSort;
|
||||
use App\Models\Traits\ScopeStatus;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Leader extends Model
|
||||
{
|
||||
use BelongsToCategory,
|
||||
HasCovers,
|
||||
ScopeStatus,
|
||||
HasSort;
|
||||
|
||||
const STATUS_FALSE = 0;
|
||||
|
||||
@@ -4,10 +4,11 @@ namespace App\Models;
|
||||
|
||||
use App\Models\Traits\BelongsToCategory;
|
||||
use App\Models\Traits\HasCovers;
|
||||
use App\Models\Traits\ScopeStatus;
|
||||
|
||||
class Staff extends Model
|
||||
{
|
||||
use BelongsToCategory, HasCovers;
|
||||
use BelongsToCategory, HasCovers,ScopeStatus;
|
||||
|
||||
|
||||
const STATUS_FALSE = 0;
|
||||
|
||||
26
app/Models/Traits/ScopeStatus.php
Normal file
26
app/Models/Traits/ScopeStatus.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Traits;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use function collect;
|
||||
|
||||
trait ScopeStatus
|
||||
{
|
||||
|
||||
/**
|
||||
* Notes: 排序
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2022/6/28 14:49
|
||||
* @param $query
|
||||
* @param $ids
|
||||
* @return mixed
|
||||
*/
|
||||
public function scopeShown($query)
|
||||
{
|
||||
return $query->where('status',1);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user