File: /mnt/data/ghayatcom/ghayatcom-api/app/DoctorsHomePage.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon;
use Storage;
use Config;
class DoctorsHomePage extends Model
{
use HasFactory;
use SoftDeletes;
protected $table = 'doctors_homepage';
protected $fillable = ['id', 'name', 'specialization','doctor_image','rating','language_spoken','created_at', 'updated_at'];
public function getDoctorImageAttribute()
{
$value = $this->attributes['doctor_image'] ?? null;
if ($value) {
if (Config::get('filesystems.default') == 's3') {
$url = Storage::temporaryUrl(
'digimed/images/home-page/doctor_image/'. $value,
now()->addMinutes(30)
);
} else {
$url = Storage::url('home-page/doctor_image/1/' . $value);
}
return $url;
}
return null;
}
}