create-isotope-app 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ export const nucleus = proton\`
|
|
|
6
6
|
// DATABASE CRUD EXAMPLE
|
|
7
7
|
try {
|
|
8
8
|
// In a real setup, you would have a 'posts' table
|
|
9
|
-
// $posts =
|
|
9
|
+
// $posts = \\Isotope\\Database::query("SELECT * FROM posts ORDER BY created_at DESC")->fetchAll();
|
|
10
10
|
|
|
11
11
|
// Mock data for demonstration if DB is not connected
|
|
12
12
|
$posts = [
|
|
@@ -18,7 +18,7 @@ try {
|
|
|
18
18
|
$action = $_POST['action'] ?? '';
|
|
19
19
|
if ($action === 'create') {
|
|
20
20
|
$title = $_POST['title'] ?? 'New Post';
|
|
21
|
-
//
|
|
21
|
+
// \\Isotope\\Database::query("INSERT INTO posts (title) VALUES (?)", [$title]);
|
|
22
22
|
header("Location: /posts");
|
|
23
23
|
exit;
|
|
24
24
|
}
|
|
@@ -28,7 +28,7 @@ try {
|
|
|
28
28
|
'posts' => $posts,
|
|
29
29
|
'db_config' => $_ENV['DB_NAME'] ?? 'Not Configured'
|
|
30
30
|
];
|
|
31
|
-
} catch (
|
|
31
|
+
} catch (\\Exception $e) {
|
|
32
32
|
return ['error' => $e->getMessage(), 'posts' => []];
|
|
33
33
|
}
|
|
34
34
|
\`;
|