🗃️ 图片表增加访问权限字段

This commit is contained in:
WispX
2021-12-13 21:27:16 +08:00
parent c5de08c00b
commit 80e8682a5f
3 changed files with 19 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Enums;
use BenSampo\Enum\Enum;
/**
* @method static static Public()
* @method static static Private()
*/
final class ImagePermission extends Enum
{
const Public = 1; // 公开
const Private = 0; // 私有
}
+3
View File
@@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property string $mimetype
* @property string $md5
* @property string $sha1
* @property int $permission
* @property boolean $is_unhealthy
* @property string $uploaded_ip
* @property Carbon $updated_at
@@ -44,6 +45,7 @@ class Image extends Model
'mimetype',
'md5',
'sha1',
'permission',
'is_unhealthy',
'uploaded_ip',
];
@@ -54,6 +56,7 @@ class Image extends Model
'strategy_id',
'uploaded_ip',
'is_unhealthy',
'permission',
];
protected $casts = [
@@ -30,6 +30,7 @@ class CreateImagesTable extends Migration
$table->string('mimetype', 32)->comment('文件类型');
$table->string('md5', 32)->comment('文件MD5');
$table->string('sha1')->comment('文件SHA1');
$table->tinyInteger('permission')->default(0)->comment('访问权限');
$table->boolean('is_unhealthy')->default(false)->comment('是否为不健康的');
$table->string('uploaded_ip')->default('')->comment('上传IP');
$table->timestamps();