staffmanager/app/TeamFile.php

42 lines
791 B
PHP
Raw Normal View History

<?php
namespace App;
2020-11-02 21:44:05 +00:00
use App\Facades\DigitalStorageHelper;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Mpociot\Teamwork\Traits\UsedByTeams;
class TeamFile extends Model
{
use HasFactory, UsedByTeams;
protected $fillable = [
'uploaded_by',
'team_id',
'name',
'fs_location',
2020-11-02 21:44:05 +00:00
'extension',
'size',
'caption',
'description'
];
public function uploader()
{
return $this->belongsTo('App\User', 'uploaded_by', 'id');
}
public function team()
{
return $this->belongsTo('App\Team');
}
2020-11-02 21:44:05 +00:00
public function getSizeAttribute($value)
{
return DigitalStorageHelper::setValue($value)->formatBytes(2, true);
}
}