<?php

namespace App;

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

class Doctor extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'image',
        'facebook',
        'twitter',
        'instagram',
        'linkedin',
    ];

    public static function withDescription()
    {
        $query = self::join('doctor_descriptions as doctorDesc', 'doctorDesc.doctor_id', 'doctors.id')
            ->where('doctorDesc.language_id', currentLanguage()->id)
            ->select(['doctors.image', 'doctorDesc.*']);

        return $query->cursor();
    }

}
