<?php

namespace App;

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

class Slider extends Model
{
    use SoftDeletes;

    protected $fillable = ['image', 'button_url'];

    public static function withDescription()
    {
        return self::orderBy('sliders.id', 'DESC')
            ->join('slider_descriptions as sd', 'sd.slider_id', 'sliders.id')
            ->where('sd.language_id', currentLanguage()->id)
            ->select(['sliders.image', 'sliders.button_url', 'sd.title', 'sd.description'])->cursor();
    }
}
