<?php
/**
 * Model object generated by: Skipper (http://www.skipper18.com)
 * Do not modify this file manually.
 */

namespace App\Models\AbstractModels;

abstract class AbstractAttivita extends \Illuminate\Foundation\Auth\User
{
    /**  
     * The table associated with the model.
     * 
     * @var string
     */
    protected $table = 'attivita';
    
    /**  
     * Primary key type.
     * 
     * @var string
     */
    protected $keyType = 'bigInteger';
    
    /**  
     * The model's default values for attributes.
     * 
     * @var array
     */
    // protected $attributes = ['is_gruppo' => 0];
    
    /**  
     * The attributes that should be cast to native types.
     * 
     * @var array
     */
    protected $casts = [
        'id' => 'integer',
        'user_id' => 'integer',
        'nome' => 'string',
        'descrizione' => 'string',
        'icona' => 'string',
        'colore' => 'string',
        'tipo' => 'string',
        'info' => 'string',
        'is_attiva' => 'boolean',
        'path_logo' => 'string',
        'path_icon' => 'string',
        'path_image' => 'string',
        'slug' => 'string',
        'user_id' => 'integer',
        'created_at' => 'datetime',
        'updated_at' => 'datetime'
    ];
    
    /**  
     * The attributes that are mass assignable.
     * 
     * @var array
     */
    protected $fillable = [
        'id',
        'user_id',
        'nome',
        'descrizione',
        'icona',
        'colore',
        'tipo',
        'info',
        'is_attiva',
        'path_logo',
        'path_icon',
        'path_image',
        'slug', 
        'user_id',
        'created_at',
        'updated_at'
    ];

    public function user()
    {
        return $this->belongsTo('\App\Models\User', 'user_id', 'id');
    }

    public function dispositivi()
    {
        return $this->hasMany('\App\Models\Dispositivo', 'attivita_id', 'id');
    }

    public function eventi()
    {
        return $this->hasMany('\App\Models\Evento', 'attivita_id', 'id');
    }

    public function prenotazioni()
    {
        return $this->hasMany('\App\Models\Prenotazione', 'attivita_id', 'id');
    }

    public function piatti()
    {
        return $this->hasMany('\App\Models\Piatto', 'attivita_id', 'id');
    }

    public function bacheche()
    {
        return $this->hasMany('\App\Models\Bacheca', 'attivita_id', 'id');
    }

    public function fornitori()
    {
        return $this->hasMany('\App\Models\Fornitore', 'attivita_id', 'id');
    }

    public function cucine()
    {
        return $this->hasMany('\App\Models\Cucina', 'attivita_id', 'id');
    }

    public function testi()
    {
        return $this->hasMany('\App\Models\Testi', 'attivita_id', 'id');
    }

    public function stampanti()
    {
        return $this->hasMany('\App\Models\Dispositivo', 'attivita_id', 'id')->where('tipo', \App\Models\Dispositivo::STAMPANTE);
    }

    public function metodo_pagamento()
    {
        return $this->hasMany('\App\Models\MetodoPagamento', 'attivita_id', 'id');
    }

    public function categorie_contabili()
    {
        return $this->hasMany('\App\Models\Categoriacontabile', 'attivita_id', 'id');
    }
    public function impostazioni()
    {
        return $this->hasMany('\App\Models\Impostazioni', 'attivita_id', 'id');
    }
    
}
