Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50.00% covered (danger)
50.00%
1 / 2
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
ProductionConsumption
50.00% covered (danger)
50.00%
1 / 2
50.00% covered (danger)
50.00%
1 / 2
2.50
0.00% covered (danger)
0.00%
0 / 1
 order
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 material
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Models;
4
5use App\Models\admin\Product;
6use Illuminate\Database\Eloquent\Model;
7
8class ProductionConsumption extends Model
9{
10    protected $fillable = ['production_order_id', 'material_id', 'planned_qty', 'actual_qty'];
11
12    protected $casts = [
13        'planned_qty' => 'decimal:4',
14        'actual_qty' => 'decimal:4',
15    ];
16
17    public function order()
18    {
19        return $this->belongsTo(ProductionOrder::class, 'production_order_id');
20    }
21
22    public function material()
23    {
24        return $this->belongsTo(Product::class, 'material_id');
25    }
26}