33 lines
592 B
PHP
Executable File
33 lines
592 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Model;
|
|
|
|
use App\Utils\Helps;
|
|
|
|
class Material extends BaseModel
|
|
{
|
|
protected $appends = [
|
|
'file_url'
|
|
];
|
|
|
|
public function getFileUrlAttribute()
|
|
{
|
|
if (!$this->path) {
|
|
return '';
|
|
}
|
|
return Helps::fullUrl($this->path);
|
|
}
|
|
|
|
// public function getPathAttribute()
|
|
// {
|
|
// if (!$this->attributes) {
|
|
// return '';
|
|
// }
|
|
// $path = @$this->attributes['path'];
|
|
// if (!$path) {
|
|
// return '';
|
|
// }
|
|
// return Helps::resizeImage($path, 'large');
|
|
// }
|
|
}
|