49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
$restaurants = [
|
|
[
|
|
'name' => 'Bonito',
|
|
'latitude' => 38.716842,
|
|
'longitude' => -9.140232,
|
|
'description' => 'A cozy place with great seafood.'
|
|
],
|
|
[
|
|
'name' => 'D\'Bacalhau',
|
|
'latitude' => 38.711963,
|
|
'longitude' => -9.133382,
|
|
'description' => 'The best codfish in town.'
|
|
],
|
|
[
|
|
'name' => 'Tasca do Chico',
|
|
'latitude' => 38.714244,
|
|
'longitude' => -9.143634,
|
|
'description' => 'Live Fado music and traditional food.'
|
|
],
|
|
[
|
|
'name' => 'Solar dos Presuntos',
|
|
'latitude' => 38.717889,
|
|
'longitude' => -9.14299,
|
|
'description' => 'Famous for its fresh seafood and lively atmosphere.'
|
|
],
|
|
[
|
|
'name' => 'Cervejaria Ramiro',
|
|
'latitude' => 38.719931,
|
|
'longitude' => -9.139225,
|
|
'description' => 'A legendary seafood restaurant.'
|
|
]
|
|
];
|
|
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("INSERT INTO restaurants (name, latitude, longitude, description) VALUES (:name, :latitude, :longitude, :description)");
|
|
|
|
foreach ($restaurants as $restaurant) {
|
|
$stmt->execute($restaurant);
|
|
}
|
|
|
|
echo "Seeding successful: " . count($restaurants) . " restaurants inserted.\n";
|
|
} catch (PDOException $e) {
|
|
die("Seeding failed: " . $e->getMessage() . "\n");
|
|
}
|