Add pilot pay to journals; cleanup payment code #130

This commit is contained in:
Nabeel Shahzad
2018-03-02 13:12:39 -06:00
parent 284db21a3a
commit 9f89447070
10 changed files with 262 additions and 151 deletions

View File

@@ -72,12 +72,5 @@ class Airline extends BaseModel
$model->icao = strtoupper($model->icao);
}
});
/**
* Make sure a new journal object is created
*/
static::created(function(Airline $model) {
$model->initJournal(config('phpvms.currency'));
});
}
}

View File

@@ -20,9 +20,8 @@ trait HashId
/**
* Register callbacks
*/
protected static function boot()
protected static function bootHashId()
{
parent::boot();
static::creating(function ($model) {
if (empty($model->id)) {
$model->id = static::createNewHashId();

View File

@@ -6,6 +6,17 @@ use App\Models\Journal;
trait JournalTrait
{
/**
* Initialize a new journal when a new record is created
*/
public static function bootJournalTrait()
{
static::created(function ($model) {
$model->initJournal(config('phpvms.currency'));
});
}
/**
* Morph to Journal.
*