Product.php 1.72 KB
Newer Older
Francisco Salazar committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
<?php

namespace Onestartup\ProductPrimerPlano\Model;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $table = 'products';
    protected $fillable = [
    	'name',
		'slug',
		'description',
		'specifications',
		'features',
		'active',
        'publication_date',
		'category_id',
        'subcategory_id',
        'cover',
        'extra1',
        'extra2',
        'extra3',
        'extra4',
        'extra5',
        'extra6',
        'extra7',
        'extra8',
        'extra9',
        'extra10',
        'extra11',

        'precio_renta',
        'tipo_moneda_renta',
        'precio_renta_tiene_oferta',
        'precio_renta_oferta',
        'precio_venta',
        'tipo_moneda_venta',
        'precio_renta_tiene_oferta',
        'precio_venta_oferta',
        'metros_construccion',
        'metros_terreno',
        'metros_frente',
        'metros_fondo',
        'banos',
        'medios_banos',
        'dormitorios',
        'edad',
49 50 51 52 53 54 55 56 57 58 59 60
        'asesor_id',

        'pais', 
        'estado', 
        'municipio', 
        'colonia', 
        'codigo_postal', 
        'calle', 
        'direccion', 
        'latitud', 
        'longitud', 
        'zoom'
Francisco Salazar committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83

    ];

    public function category()
    {
        return $this->belongsTo('Onestartup\ProductPrimerPlano\Model\ProductCategory', 'category_id');
    }

    public function subcategory()
    {
        return $this->belongsTo('Onestartup\ProductPrimerPlano\Model\ProductSubCategory', 'subcategory_id');
    }

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

    public function images()
    {
        return $this->hasMany('Onestartup\ProductPrimerPlano\Model\ProductImage', 'product_id');
    }
}