Fix testing as a result of changes in 34139bc
This commit is contained in:
@@ -23,7 +23,7 @@ trait NextKey
|
||||
$model->id = self::NextId();
|
||||
|
||||
if (! $model->site_id)
|
||||
$model->site_id = config('SITE')->id;
|
||||
$model->site_id = config('SITE')->site_id;
|
||||
});
|
||||
|
||||
static::saved(function($model)
|
||||
@@ -33,21 +33,22 @@ trait NextKey
|
||||
throw new \Exception('Missing record_id const for '.get_class($model));
|
||||
|
||||
try {
|
||||
$mo = Module::where('name',$model::RECORD_ID)->firstOrFail();
|
||||
$mo = Module::where('name',$model::RECORD_ID)
|
||||
->where('site_id',$model->site_id)->firstOrFail();
|
||||
|
||||
} catch (ModelNotFoundException $e) {
|
||||
Log::critical(sprintf('Module [%s] not recorded, we\'ll create it.',$model::RECORD_ID),['model'=>$model->getAttributes()]);
|
||||
|
||||
$mo = new Module;
|
||||
$mo->name = $model::RECORD_ID;
|
||||
$mo->site_id = $model->site_id ?: config('SITE')->id;
|
||||
$mo->site_id = $model->site_id ?: config('SITE')->site_id;
|
||||
$mo->save();
|
||||
}
|
||||
|
||||
if (! $mo->record) {
|
||||
$mo->record = new Record;
|
||||
$mo->record->module_id = $mo->id;
|
||||
$mo->record->site_id = $model->site_id ?: config('SITE')->id;
|
||||
$mo->record->site_id = $model->site_id ?: config('SITE')->site_id;
|
||||
}
|
||||
|
||||
$mo->record->id = $model->id;
|
||||
|
Reference in New Issue
Block a user