'integer', 'debit' => 'integer', 'post_date' => 'datetime', 'tags' => 'array', ]; //protected $dateFormat = 'Y-m-d'; protected $dates = [ 'created_at', 'updated_at', 'post_date', ]; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function journal() { return $this->belongsTo(Journal::class); } /** * @param Model $object * @return JournalTransaction */ public function referencesObject($object) { $this->ref_class = \get_class($object); $this->ref_class_id = $object->id; $this->save(); return $this; } /** * */ public function getReferencedObject() { if ($classname = $this->ref_class) { $klass = new $this->ref_class; return $klass->find($this->ref_class_id); } return false; } /** * @param string $currency */ public function setCurrency($currency) { $this->currency = $currency; } }