Blog.php
562 字节
<?php
namespace App\Models\Blog;
use App\Models\Base;
use App\Models\User\User;
class Blog extends Base
{
const STATUS_DRAFT = 0;
const STATUS_ONE = 1;
protected $table = 'gl_blog';
//连接数据库
protected $connection = 'custom_mysql';
public function user(){
return $this->hasMany(User::class,'operator_id','id');
}
public function getReleaseAtAttribute($value){
if(!$value){
return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at')));
}
return $value;
}
}