ldc-legaulois/app/Models/Ranges.php

29 lines
509 B
PHP
Raw Normal View History

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
/**
* 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');
}
public function reductions()
{
2021-02-24 09:12:02 +01:00
return $this->belongsToMany(Reductions::class, 'reduction_config', 'range_id', 'reduction_id');
}
2020-09-21 11:03:50 +02:00
}