Commit cee3d9ae by lujunyi

返回图片

parent 745d2b68
......@@ -5,6 +5,8 @@
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class DoctorModel extends Model
{
......@@ -18,4 +20,13 @@ public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
public function getSignedPicAttribute($value)
{
if (Str::contains($value, '//')) {
return $value;
}
return Storage::url($value);
}
}
......@@ -5,6 +5,8 @@
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class PharmacistModel extends Model
{
......@@ -18,4 +20,13 @@ public function pharmacy()
{
return $this->belongsTo(PharmacyModel::class, 'pharmacy_id', 'id');
}
public function getSignedPicAttribute($value)
{
if (Str::contains($value, '//')) {
return $value;
}
return Storage::url($value);
}
}
......@@ -5,6 +5,8 @@
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class PrescriptionModel extends Model
{
......@@ -37,4 +39,31 @@ class PrescriptionModel extends Model
self::OPEN_SOURCE_CUSTOMER => '客开',
self::OPEN_SOURCE_PHARMACY => '店开',
];
public function getDoctorSignedPicAttribute($value)
{
if (Str::contains($value, '//')) {
return $value;
}
return Storage::url($value);
}
public function getPharmacistSignedPicAttribute($value)
{
if (Str::contains($value, '//')) {
return $value;
}
return Storage::url($value);
}
public function getPrescriptionPicAttribute($value)
{
if (Str::contains($value, '//')) {
return $value;
}
return Storage::url($value);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment