%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/sljcon/app/Models/
Upload File :
Create Path :
Current File : /var/www/html/sljcon/app/Models/Testimonial.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Testimonial extends Model
{
    protected $fillable = [
        'isApproved',
        'isDeleted',
        'description',
        'fullName',
        'jobPosition'
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\MorphOne
     */
    public function media()
    {
        return $this->morphOne(Media::class, 'reference')->where('media_type', Media::MEDIA_TYPE_TESTIMONIAL_IMAGE)->first();
    }

    /**
     * @return string
     */
    public function imageUrl()
    {
        if ($this->media()) {
            return env('APP_URL') . 'uploads/testimonial/' . $this->media()->file_name;
        }
        return env('APP_URL') . 'uploads/testimonial/avatar.png';
    }

    /**
     * @return string
     */
    public function statusName()
    {
        return $this->isApproved ? "Published" : "Draft";
    }
}

Zerion Mini Shell 1.0