<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Testimonial extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'image',
//        'evaluate',
        'status',
    ];

    public static function withDescription()
    {
        return self::orderByDesc('testimonials.id')
            ->where('testimonials.status', 1)->join('testimonial_descriptions as sd', 'sd.testimonial_id', 'testimonials.id')
            ->where('sd.language_id', currentLanguage()->id)
            ->select(['testimonials.image', 'sd.name', 'sd.job_title', 'sd.comment'])->cursor() ?? [];
    }
}
