图集
This commit is contained in:
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Advert;
|
||||
use App\Models\Category;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
@@ -33,6 +31,10 @@ class CategoryController extends Controller
|
||||
if ($category->type == Category::TYPE_ADVERT) {
|
||||
$template = 'images';
|
||||
}
|
||||
|
||||
if ($category->type == Category::TYPE_PHOTO) {
|
||||
$template = 'photos';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,11 +18,13 @@ class Category extends Model
|
||||
public const TYPE_ARTICLE = 'article';
|
||||
public const TYPE_ADVERT = 'advert';
|
||||
public const TYPE_VIDEO = 'video';
|
||||
public const TYPE_PHOTO = 'photo';
|
||||
public const TYPE_LINK = 'link';
|
||||
public const TYPES = [
|
||||
self::TYPE_ARTICLE => '文章列表',
|
||||
self::TYPE_SHOW => '文章详情',
|
||||
self::TYPE_ADVERT => '图片列表',
|
||||
self::TYPE_PHOTO => '图集',
|
||||
self::TYPE_VIDEO => '视频列表',
|
||||
self::TYPE_LINK => '跳转链接',
|
||||
];
|
||||
@@ -41,6 +43,7 @@ class Category extends Model
|
||||
|
||||
/**
|
||||
* Notes: description
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/10/14 11:53
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo|\Illuminate\Database\Eloquent\Relations\HasMany|null
|
||||
@@ -57,6 +60,7 @@ class Category extends Model
|
||||
return $this->hasMany(Article::class);
|
||||
break;
|
||||
case self::TYPE_ADVERT:
|
||||
case self::TYPE_PHOTO:
|
||||
return $this->hasMany(Advert::class);
|
||||
break;
|
||||
case self::TYPE_VIDEO:
|
||||
@@ -84,6 +88,7 @@ class Category extends Model
|
||||
|
||||
/**
|
||||
* Notes: 获取当前分类及子分类ID
|
||||
*
|
||||
* @Author: <C.Jason>
|
||||
* @Date : 2020/4/6 3:12 下午
|
||||
* @return array
|
||||
@@ -113,6 +118,7 @@ class Category extends Model
|
||||
|
||||
/**
|
||||
* Notes: 格式化description
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/10/8 15:24
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user