HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux Bradford-Sitios 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: www-data (33)
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/dtw.bradford/app/Models/OdooAccountMoves.php
<?php

namespace App\Models;

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

class OdooAccountMoves extends Model
{
    use HasFactory;

    protected $table = 'odoo_account_moves_view';

    public $timestamps = false;

    protected $fillable = [
        'account_move_id',
        'name',
        'display_name',
        'state',
        'move_type',
        'ref',
        'date',
        'currency_id',
        'currency',
        'amount_total',
        'amount_total_words',
        'partner_id',
        'partner',
        'journal_id',
        'journal',
        'partner_bank_id',
        'partner_bank',
        'company_id',
        'company',
        'create_uid_id',
        'create_uid_name',
        'account_move_lines' // JSON con los detalles de el asiento contable
    ];

     // Método para obtener detalles de líneas de el asiento contable
    protected function details()
    {
        // Decode JSON from account_move_lines to an array
        return collect(json_decode($this->account_move_lines, true))->map(function ($line) {
            return [
                'line_id' => $line['line_id'],
                'move_id' => $line['move_id'],
                'name' => $line['name'],
                'account_id' => $line['account_id'],
                'account' => $line['account'],
                'company_id' => $line['company_id'],
                'company' => $line['company'],
                'debit' => $line['debit'],
                'credit' => $line['credit'],
            ];
        });
    }
 
    // Sobrescribir el método toArray
    public function toArray()
    {
        $array = parent::toArray();
        $array['account_move_lines'] = $this->details(); // Añadir las líneas formateadas
        return $array;
    }
}