Record activity for the "created" event.

@param  \Illuminate\Database\Eloquent\Model  $instance
@return void
544757
public function created($instance)
    {
        $after = $this->recordableAttributes(get_class($instance), $instance->getAttributes());

        $instance->recordActivity('created', null, $after);
    }
511611
private function record(Request $request, string $event)
    {
        $this->traces[$this->getTraceKey($request)][] = $event;
    }
844741
public function creating(Model $model)
    {
        if (! $model->created_by) {
            $model->created_by = $this->getAuthenticatedUserId();
        }

        if (! $model->updated_by) {
            $model->updated_by = $this->getAuthenticatedUserId();
        }
    }
697844
public function initialize($instance, ServiceLocatorInterface $serviceLocator)
    {
        if ($instance instanceof ApplicationDbAware) {
            $instance->setApplicationDb($serviceLocator->get('prooph.link.app.db'));
        }
    }
1179656
public function created(Model $model)
    {
        $langs = app('languages')->langs();
        DB::beginTransaction();
        try {
            foreach ($langs as $lang) {
                $this->saveTranslatedMessage($model, $lang);
            }
        } catch (Exception $ex) {
            DB::rollback();
            throw $ex;
        }
        DB::commit();
        return true;
    }
223112
public static function setInstance($instance)
    {
        if ($instance === null) {
            unset(Zilf::$app->loadedModules[get_called_class()]);
        } else {
            Zilf::$app->loadedModules[get_class($instance)] = $instance;
        }
    }
806166
public function processQueue(Model $instance, $path = null, bool $cleanup = true)
    {
        $this->setInstance($instance);

        // Determine the path to use
        $path = $path ?: $this->getQueuedFilePath();

        // Set the file for processing
        $this->addUploadedFile($path);

        // Start processing the file
        $this->save();

        // Save all updated model attributes
        $this->getInstance()->save();

        // TODO: also remove non-local files
        // Remove queued file locally
        if ($cleanup === true && realpath($path) !== false) {
            @unlink($path);
            @rmdir(dirname($path));
        }
    }
1088764
public function record(Model $model = null, $name, $user = null)
    {
        if ( ! $this->isEnabled())
        {
            return false;
        }

        $activity = $this->initActivity();

        // Auto determine user if none is supplied
        $user = $this->getUserId($user);

        $data = [
            'name'    => $name,
            'user_id' => $user
        ];

        if ($model)
        {
            $data['subject_id'] = $model->getKey();
            $data['subject_type'] = get_class($model);
        }

        $activity->fill($data);

        $activity->save();

        return $activity;
    }
966558
public function creating($model)
    {
        if ($model->accountableEnabled()) {
            $model->{$this->config['column_names']['created_by']} = $this->accountableUserId();
            $model->{$this->config['column_names']['updated_by']} = $this->accountableUserId();
        }
    }
638415
public function update_instance($instance, $data) {
        global $DB;

        // Delete all other instances, leaving only one.
        if ($instances = $DB->get_records('enrol', array('courseid' => $instance->courseid, 'enrol' => 'manual'), 'id ASC')) {
            foreach ($instances as $anotherinstance) {
                if ($anotherinstance->id != $instance->id) {
                    $this->delete_instance($anotherinstance);
                }
            }
        }
        return parent::update_instance($instance, $data);
    }
521594
public function removeInstance(WidgetInstance $instance)
    {
        if ($this->instances->contains($instance)) {
            $this->instances->removeElement($instance);
        }
    }
1212480
final public static function setInstance($instance)
    {
        if ($instance instanceof PDO) {
            $instance = $instance->getAttribute(PDO::ATTR_DRIVER_NAME);
        }
        if (is_string($instance)) {
            if (class_exists('SQL\Writer\\' . $instance)) {
                $class = 'SQL\Writer\\' . $instance ;
                $instance = new $class;
            } else {
                $instance = new self;
            }
        }

        if (!($instance instanceof self)) {
            throw new RuntimeException('$instance must an instanceof SQL\Writer');
        }

        self::$instance = $instance;
    }
304544
public static function store($instance, $name = null)
    {
        if (!$name) {
            $name = get_class($instance);
        }
        $name = self::cleanName($name);
        self::$instances[$name] = $instance;
    }
139930
public function addInstance(WidgetInstance $instance)
    {
        if (!$this->instances->contains($instance)) {
            $this->instances->add($instance);
            $instance->setContainer($this);
        }
    }
1263730
protected function handleEventsLogging($model)
    {
        if (config($this->package.'.log_events_to_file') === true) {
            $this->logEventsToFile($model);
        }

        if (config($this->package.'.log_events_to_db') === true) {
            $this->logEventsToDB($model);
        }
    }
237252
public function remove(Instance $instance)
    {
        $key = $this->getHash().$instance->getId();
        if($this->getFileManager()->has($key)) {
            $this->getFileManager()->delete($key);
        }
    }
948937
public function update_instance($instance, $data) {
        if ($data) {
            $data->cost = unformat_float($data->cost);
        }
        return parent::update_instance($instance, $data);
    }