first commit
This commit is contained in:
31
app/Models/System/Tasks.php
Normal file
31
app/Models/System/Tasks.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user