- 新增3个migration(9张表): office(6表)/report(1表)/kb(2表) - 新增9个Model + 9个Controller - 新增43条API路由(总计305条) - 新增3个前端API模块 + 10个管理页面 - 迁移运行通过, vite build验证通过
34 lines
738 B
PHP
34 lines
738 B
PHP
<?php
|
|
|
|
namespace App\Models\Office;
|
|
|
|
use App\Models\User;
|
|
use App\Traits\BelongsToStore;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Announcement extends Model
|
|
{
|
|
use BelongsToStore;
|
|
|
|
protected $fillable = [
|
|
'store_id', 'title', 'content', 'type', 'is_top',
|
|
'publish_status', 'published_at', 'author_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'type' => 'integer',
|
|
'publish_status' => 'integer',
|
|
'is_top' => 'boolean',
|
|
'published_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function author(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'author_id');
|
|
}
|
|
}
|