<?php

namespace App;

use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use Krnos\Fire\HasChanges;

class {{model}} extends Model
{
  use SoftDeletes;
  use HasChanges;

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

  // Nombre de la tabla en MySQL.
	protected $table='{{varPluralModel}}';

  // Atributos que se pueden asignar de manera masiva.
  protected $fillable = array();

  // Aquí ponemos los campos que no queremos que se devuelvan en las consultas.
  protected $hidden = ['created_at','updated_at'];

  // Constantes para status
  const PENDING = 1;
  const APPROVED = 2;
  const CANCELLED = 3;
  const PAID = 4;

  public function getStatusDisplayAttribute()
  {
    switch ($this->status) {
      case self::PENDING:
      return __('articles.pending');
      case self::APPROVED:
      return __('articles.aproved');
      case self::CANCELLED:
      return __('articles.cancelled');
      case self::PAID:
      return __('articles.paid');
    }
  }

  public function getModelLabel()
  {
    return $this->name;
  }

  // Relaciones
/*   public function customer()
  {
    return $this->belongsTo('App\Customer');
  } */
}
