transactionjournals()->orderBy('updated_at', 'DESC')->first(); if (is_null($transaction)) { return null; } return $transaction->date; } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function transactionjournals() { return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id'); } }