2020-09-21 11:03:50 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class Ranges extends Model
|
|
|
|
|
{
|
2021-03-20 14:38:15 +01:00
|
|
|
|
2021-02-02 10:26:36 +01:00
|
|
|
/**
|
|
|
|
|
* The attributes that should be cast.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'color' => HtmlColor::class
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function products()
|
|
|
|
|
{
|
2021-02-09 09:50:17 +01:00
|
|
|
return $this->hasMany(Products::class, 'range_id');
|
2020-10-06 17:34:41 +02:00
|
|
|
}
|
2020-12-17 17:15:06 +01:00
|
|
|
|
2021-02-02 10:26:36 +01:00
|
|
|
public function reductions()
|
|
|
|
|
{
|
2021-02-24 09:12:02 +01:00
|
|
|
return $this->belongsToMany(Reductions::class, 'reduction_config', 'range_id', 'reduction_id');
|
2020-12-17 17:15:06 +01:00
|
|
|
}
|
2020-09-21 11:03:50 +02:00
|
|
|
}
|