Changed ezypay matching to use referenceid, fixed NextKey for existing records
This commit is contained in:
@@ -22,12 +22,14 @@ trait NextKey
|
||||
|
||||
static::saved(function($model)
|
||||
{
|
||||
if (! $model::RECORD_ID)
|
||||
throw new \Exception('Missing record_id const for '.get_class($model));
|
||||
if ($model->wasRecentlyCreated) {
|
||||
if (! defined(get_class($model).'::RECORD_ID'))
|
||||
throw new \Exception('Missing record_id const for '.get_class($model));
|
||||
|
||||
$mo = Module::where('name',$model::RECORD_ID)->firstOrFail();
|
||||
$mo->record->id = $model->id;
|
||||
$mo->record->save();
|
||||
$mo = Module::where('name',$model::RECORD_ID)->firstOrFail();
|
||||
$mo->record->id = $model->id;
|
||||
$mo->record->save();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user