Anons79 Mini Shell

Directory : /home/aplikasiposinfo/public_html/coba.fixmate.id/app/Models/
Upload File :
Current File : /home/aplikasiposinfo/public_html/coba.fixmate.id/app/Models/DetailService.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class DetailService extends Model
{
    use HasFactory;
    use SoftDeletes;

    protected $fillable = [
        "service_id",
        "sparepart_id",
        "item_id",
        "akhir_garansi",
        "jumlah",
        'diskon',
        'diskon_persen',
        'diskon_poin',
        "nama_item",
        "harga_item",
        "biaya_item",
    ];

    public function service(){
        return $this->belongsTo(Service::class);
    }

    public function sparepart()
    {
        return $this->belongsTo(Item::class, 'item_id', 'id');
    }
    public function getTotalSparepartAttribute()
    {
        $total = 0;


        $total += (($this->harga_diskon)) * $this->jumlah;


        return $total;
    }
    public function getModalSparepartAttribute()
    {
        $total = 0;


        $total += $this->biaya_item * $this->jumlah;


        return $total;
    }
    public function getHargaDiskonAttribute()
    {
        $total = 0;


        $total += $this->harga_item - $this->diskon;

        return $total;
    }
}

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]