Backend for file uploads attached to any generic model, initially on aircraft and airports #226

This commit is contained in:
Nabeel Shahzad
2018-04-01 18:02:12 -05:00
parent 793b3e7134
commit e358b8706f
19 changed files with 437 additions and 38 deletions

View File

@@ -7,6 +7,7 @@
namespace App\Models;
use App\Interfaces\Model;
use App\Models\Traits\ReferenceTrait;
/**
* @property string id UUID type
@@ -22,6 +23,8 @@ use App\Interfaces\Model;
*/
class JournalTransaction extends Model
{
use ReferenceTrait;
protected $table = 'journal_transactions';
public $incrementing = false;
@@ -61,33 +64,6 @@ class JournalTransaction extends Model
return $this->belongsTo(Journal::class);
}
/**
* @param Model $object
* @return JournalTransaction
*/
public function referencesObject($object)
{
$this->ref_model = \get_class($object);
$this->ref_model_id = $object->id;
$this->save();
return $this;
}
/**
*
*/
public function getReferencedObject()
{
if ($classname = $this->ref_model) {
$klass = new $this->ref_model;
return $klass->find($this->ref_model_id);
}
return false;
}
/**
* @param string $currency
*/