34 lines
966 B
PHP
34 lines
966 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* App\Disk
|
|
*
|
|
* @property int $id
|
|
* @property string $name 名稱
|
|
* @property-read mixed $path
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\MediaFile[] $mediaFiles
|
|
* @property-read int|null $media_files_count
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Disk newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Disk newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Disk query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Disk whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Disk whereName($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Disk extends Model
|
|
{
|
|
public function getPathAttribute()
|
|
{
|
|
return config('filesystems.disks.' . $this->name)['root'];
|
|
}
|
|
|
|
public function mediaFiles()
|
|
{
|
|
return $this->hasMany(MediaFile::class);
|
|
}
|
|
}
|