<?php

namespace App;

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

class WorkWay extends Model
{
    use SoftDeletes;

    protected $fillable = ['image'];

    public static function withDescription()
    {
        $language_id = currentLanguage()->id;
        return self::join('work_way_descriptions as wd', 'wd.work_way_id', 'work_ways.id')
            ->where('wd.language_id', $language_id)
            ->select(['work_ways.*', 'wd.title', 'wd.description'])->cursor();
    }
}
