Some checks failed
Admin | Playwright Tests / Admin | Playwright Tests | Shard 1 Of 6 (push) Failing after 37s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 2 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 4 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 6 Of 6 (push) Failing after 6s
Linting Tests / PHP 8.3 test on ubuntu-latest (push) Failing after 5s
CI / PHP 8.3 test on ubuntu-latest (push) Failing after 6s
Skills Consistency / validate-skills (push) Successful in 10s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 3 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 5 Of 6 (push) Failing after 6s
62 lines
1.1 KiB
PHP
62 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Webkul\Lead\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Webkul\Lead\Contracts\Product as ProductContract;
|
|
use Webkul\Product\Models\ProductProxy;
|
|
|
|
class Product extends Model implements ProductContract
|
|
{
|
|
protected $table = 'lead_products';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'quantity',
|
|
'price',
|
|
'amount',
|
|
'product_id',
|
|
'lead_id',
|
|
];
|
|
|
|
/**
|
|
* Get the product owns the lead product.
|
|
*/
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(ProductProxy::modelClass());
|
|
}
|
|
|
|
/**
|
|
* Get the lead that owns the lead product.
|
|
*/
|
|
public function lead()
|
|
{
|
|
return $this->belongsTo(LeadProxy::modelClass());
|
|
}
|
|
|
|
/**
|
|
* Get the customer full name.
|
|
*/
|
|
public function getNameAttribute()
|
|
{
|
|
return $this->product->name;
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function toArray()
|
|
{
|
|
$array = parent::toArray();
|
|
|
|
$array['name'] = $this->name;
|
|
|
|
return $array;
|
|
}
|
|
}
|