public function fresh($with = []) { if (!$this->exists) { return; } if (is_string($with)) { $with = func_get_args(); } $key = $this->getKeyName(); return static::newQueryWithoutScopes()->with($with)->where($key, $this->getKey())->first(); }
/** * If object was saved * * @param string $message */ public function updated($message) { $model = $this->model->fresh(); if ($model->updated_at->diffInSeconds() < 5) { return $this->flash->success($message); } $this->error(trans('alert::errors.updating')); }