Files
new_dqb_new/app/Models/Traits/BelongsToCategory.php
2021-03-24 09:51:17 +08:00

22 lines
363 B
PHP

<?php
namespace App\Models\Traits;
use App\Models\Category;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
trait BelongsToCategory
{
/**
* 关联分类表
* @author 玄尘 2020-03-05
* @return BelongsTo
*/
public function category(): BelongsTo
{
return $this->belongsTo(Category::class)->withDefault();
}
}