<?php namespace Tussendoor\Reloadify\Models\AbandonedCart;

use ReloadifyScoped\Illuminate\Database\Eloquent\Model;

class AbandonedCartMeta extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'reloadify_cart_meta';

    /**
     * The parent to touch when actions are performed on this model.
     * 
     * @since 1.4.0
     * 
     * @var array
     */
    protected $touches = [
        'cart'
    ];
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'cart_id',
        'meta_key',
        'meta_value',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var array
     */
    protected $hidden = [
        'id',
        'cart_id',
        'created_at',
        'updated_at',
    ];
    
    /**
     * Get the cart relationship
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function cart()
    {
        return $this->belongsTo(AbandonedCart::class, 'cart_id', 'id');
    }
}