<?php

namespace App;

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

class Article extends Model
{
  use SoftDeletes;

  /**
   * The attributes that should be mutated to dates.
   *
   * @var array
   */
  protected $dates = ['deleted_at'];

  protected $fillable = array('name', 'type', 'description', 'priece');

  protected $hidden = ['created_at','updated_at'];

  const TYPE_PRODUCT = 1;
  const TYPE_SERVICE = 2;

  public function isProduct() {
    return $this->type === self::TYPE_PRODUCT;
  }

  public function isService() {
    return $this->type === self::TYPE_SERVICE;
  }
}
