HEX
Server: nginx/1.24.0
System: Linux rtfmfm 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User: neo (1001)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/wsklad/app/MobileSaleDocumentHistory.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class MobileSaleDocumentHistory extends Model
{
    protected $table = 'mobile_sale_documents_history';
    protected $guarded = [];
    public $timestamps = true;

    public function details()
    {
        return $this->hasMany(MobileSaleDocumentDetailHistory::class, 'mobilesaledocument_id');
    }

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function distributor()
    {
        return $this->hasOne('App\Ajurendpointdistributor', 'F_KONTRAGENT', 'distributorCode');
    }

    public function paymentMethod()
    {
        return $this->hasOne('App\Ajurendpointpaymentmethod', 'PAYMENT', 'payment');
    }

    public function distributorDetails()
    {
        return $this->hasOne('App\Distributordetail', 'F_KONTRAGENT', 'distributorCode');
    }

    public function receiverData()
    {
        return $this->hasOne('App\Ajurendpointreceiver', 'F_KONTRAGENT', 'receiver');
    }

    public function inMaker()
    {
        return $this->hasOne('App\User', 'id', 'eSkladOperator');
    }

    public function getDocTypeNameAttribute()
    {
        $docTypeNames = [
            'invoice' => 'Фактура',
            'billOfGoods' => 'Стокова разписка',
            'creditNote' => 'Кредитно известие',
            'debitNote' => 'Дебитно известие',
        ];

        return $docTypeNames[$this->docType] ?? 'Неизвестен';
    }

    public static function getDocTypeName($docType)
    {
        $docTypeNames = [
            'invoice' => 'Фактура',
            'billOfGoods' => 'Стокова разписка',
            'creditNote' => 'Кредитно известие',
            'debitNote' => 'Дебитно известие',
        ];

        return $docTypeNames[$docType] ?? 'Неизвестен';
    }


    /**
     * Get the human-readable name for the action field.
     *
     * @return string
     */
    public function getActionNameAttribute()
    {
        $actionNames = [
            'delete' => 'изтриване на ред',
            'create' => 'добавяне на ред',
            'update' => 'редакция на ред',
            'changeReceiver' => 'смяна на получател',
        ];
        return $actionNames[$this->action] ?? 'Неизвестно действие';
    }

    /**
     * Static method to get the human-readable name for a given action code.
     *
     * @param string $action
     * @return string
     */
    public static function getActionName($action)
    {
        $actionNames = [
            'delete' => 'изтриване на ред',
            'create' => 'добавяне на ред',
            'update' => 'редакция на ред',
            'changeReceiver' => 'смяна на получател',
        ];
        return $actionNames[$action] ?? 'Неизвестно действие';
    }

    protected $appends = [
        'docTypeName',
        'actionName',
    ];

    protected $casts = [
        'payment' => 'string',
    ];
}