檔案位於 vendor\encore\laravel-admin\src\Form\Field\Image.php
<?php
namespace Encore\Admin\Form\Field;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class Image extends File
{
use ImageField;
/**
* {@inheritdoc}
*/
protected $view = 'admin::form.file';
/**
* Validation rules.
*
* @var string
*/
protected $rules = 'image';
/**
* @param array|UploadedFile $image
*
* @return string
*/
public function prepare($image)
{
if (request()->has(static::FILE_DELETE_FLAG)) {
return $this->destroy();
}
$this->name = $this->getStoreName($image);
$this->callInterventionMethods($image->getRealPath());
$path = $this->uploadAndDeleteOriginal($image);
$this->uploadAndDeleteOriginalThumbnail($image);
//將這裡修改即可
//--start dyushuo6230 2019-12-18
return "/upload/" . $path;
//--end dyushuo6230 2019-12-18
}
}
————————————————
版權宣告:本文為CSDN博主「哈佛凌晨」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處連結及本宣告。
原文連結:blog.csdn.net/dyushuo6230/article/...
本作品採用《CC 協議》,轉載必須註明作者和本文連結