Anons79 Mini Shell

Directory : /home/aplikasiposinfo/public_html/hayyumart.com/app/
Upload File :
Current File : /home/aplikasiposinfo/public_html/hayyumart.com/app/PembayaranSupplier.php

<?php

namespace App;

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

class PembayaranSupplier extends Model
{
    use SoftDeletes;
    protected $guarded = [];
    protected $primaryKey = "no_pembayaran";
    public $incrementing = false;

    public function supplier()
    {
    	return $this->belongsTo(Supplier::class,'kd_supplier')->withTrashed();
    }

    public function prepared()
    {
        return $this->belongsTo(User::class,'prepared_id')->withTrashed();
    }

    public function reviewed()
    {
        return $this->belongsTo(User::class,'reviewed_id')->withTrashed();
    }

    public function approved()
    {
        return $this->belongsTo(User::class,'approved_id')->withTrashed();
    }

    public function rejected()
    {
        return $this->belongsTo(User::class,'rejected_id')->withTrashed();
    }

    public function detail_upload()
    {
    	return $this->hasMany(DetailFotoPembayaranSupplier::class,'no_pembayaran');
    }

    public function detail_bukti()
    {
    	return $this->hasMany(DetailBuktiPembayaranSupplier::class,'no_pembayaran')->withTrashed();
    }

    public function getStatusAttribute()
    {
        $status = 'Prepared';
        if ($this->approved_id) {
            $status = 'Approved';
            if ($this->reviewed_id) {
                $status = 'Reviewed';
            }
        }

        if ($this->rejected_id) {
            $status = 'Rejected';
        }
        
        return $status;
    }

    public function getNextStatusAttribute()
    {
        $nextStatus = 'Approve';
        if ($this->approved_id) {
            $nextStatus = 'Review';
        }
        
        return $nextStatus;
    }
}

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