sarga/packages/Webkul/Customer/src/Models/Wishlist.php

48 lines
954 B
PHP
Raw Normal View History

<?php
namespace Webkul\Customer\Models;
use Illuminate\Database\Eloquent\Model;
2019-02-18 07:30:40 +00:00
use Webkul\Customer\Contracts\Wishlist as WishlistContract;
use Webkul\Product\Models\ProductProxy;
2019-02-18 07:30:40 +00:00
class Wishlist extends Model implements WishlistContract
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wishlist';
/**
* The attributes that should be cast.
*
* @var array
*/
2019-08-19 09:30:24 +00:00
protected $casts = [
'additional' => 'array',
];
2018-10-05 12:00:48 +00:00
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [
'id',
'created_at',
'updated_at',
2020-02-27 08:03:03 +00:00
];
2019-08-19 09:30:24 +00:00
/**
* The product that belong to the wishlist.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
2019-08-19 09:30:24 +00:00
*/
public function product()
{
2019-02-18 07:30:40 +00:00
return $this->hasOne(ProductProxy::modelClass(), 'id', 'product_id');
2018-10-05 12:00:48 +00:00
}
}