32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
|
// +----------------------------------------------------------------------
|
|
namespace App\Models\System;
|
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use App\Models\Auth\Admin;
|
|
|
|
class Tasks extends \App\Models\BaseModel {
|
|
|
|
protected $table = 'system_tasks';
|
|
protected $fillable = [];
|
|
protected $hidden = ['deleted_at'];
|
|
protected $append = ['url'];
|
|
|
|
public function url(): Attribute{
|
|
return Attribute::make(
|
|
get: fn (mixed $value, array $data) => Storage::disk('public')->url($data['file']),
|
|
);
|
|
}
|
|
|
|
public function user() {
|
|
return $this->belongsTo(Admin::class, 'user_id', 'uid');
|
|
}
|
|
}
|