/** Datei: plugins/projects/hooks/model/updated.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * * @hook model::updated->projects_types * @param mixed $result save result * @param string $table Current Database Table Name * @param object $query Database\QueryBuilder Object * @param string $hook Hook type/name * @param array $changed changed Data * @param string $class Current static class * * @since 1.0.0 File is created */ use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Projects\Types; if( key_exists( "status", $changed ) ) { if( $changed["status"] === Types\Status::Default ) { $types = Types\Model::getAll([ "status" => Types\Status::Default, "id__NOT" => $result, ]); foreach( $types as $type ) { $type->save([ "status" => Types\Status::Active, ]); if( PUBLIC_SCRIPT_NAME ) { REST\Response::addUpdater( [ "data/table/row", $type->getHashId() ], $type ); } } } } return $result;