File: /var/www/ipsremont-demo/app/Models/ShipmentParts.php
<?php
namespace App\Models;
use App\Traits\Displayed;
use App\Traits\My;
use App\Traits\Sortable;
use Illuminate\Database\Eloquent\SoftDeletes;
class ShipmentParts extends BaseModel
{
use SoftDeletes, Sortable, Displayed, My;
protected $table = 'shipment_parts';
protected $fillable = [
'shipment_id',
'part_id',
'amount',
];
public function part()
{
return $this->belongsTo(Part::class)->withTrashed();
}
public function _save($shipment_id, $part_id, $amount)
{
$this->shipment_id = $shipment_id;
$this->part_id = $part_id;
$this->amount = $amount;
$this->save();
}
}