<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class PageDescription extends Model
{
    // For Mass Assignment
    protected $fillable = ['language_id','title','description','meta_description', 'keywords', 'slug', 'page_id'];

    // ShutDown Timestamps
    public $timestamps = false;

    /**
     * Returns PageDescriptions
     *
     * @return Query
    */
    public static function GetByPageId($id)
    {
        $query = PageDescription::where('page_id', $id)
        ->join('languages', 'languages.id', 'page_descriptions.language_id')
        ->select(['page_descriptions.*', 'languages.local']);

        return $query->cursor();

    }
}
