Open promanapeople opened 1 year ago
Any update on this topic? I've got the same error in a fresh laravel app.
EDIT: Okay I fixed it by creating two tables in the database:
create table pagebuilder__settings (
id int NOT NULL AUTO_INCREMENT,
settings varchar(50) UNIQUE,
value MEDIUMTEXT,
is_array BOOLEAN,
created_at DATETIME,
updated_at DATETIME, PRIMARY KEY (id)
);
create table pagebuilder__page_translations (
id int NOT NULL AUTO_INCREMENT,
page_id INT UNSIGNED NOT NULL,
locale VARCHAR(50),
title VARCHAR(255),
route VARCHAR(255),
created_at DATETIME,
updated_at DATETIME,
PRIMARY KEY (id)
);
After that just run php artisan migrate:fresh()
. Only use this if you have nothing of value in your database ofcourse!!
once php artisan vendor:publish, remove the database prefix in cofig file to complete the config:cache. i found might be database migration run before config file read causing issue to this command broken.
public function all(string $table, $columns = '*') { $this->checkAndCreateTable($table); if (is_array($columns)) { foreach ($columns as &$column) { $column = preg_replace('/[^a-zA-Z_]*/', '', $column); } $columns = implode(',', $columns); $stmt = $this->pdo->prepare("SELECT {$columns} FROM {$table}"); } else { $stmt = $this->pdo->prepare("SELECT * FROM {$table}"); } $stmt->execute() return $stmt->fetchAll(); }
`public function checkAndCreateTable(string $tableName)
{
$tableExists = $this->pdo->query("SHOW TABLES LIKE '{$tableName}'")->rowCount() > 0;
if (!$tableExists) {
// Tablo yok, oluştur
$createQuery = "CREATE TABLE {$tableName} (
id INT AUTO_INCREMENT PRIMARY KEY,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)";
$this->pdo->exec($createQuery);
return true;
}
return true;
}`
line 54 in phpagebuilder/src/Core/DB.php
I will try to solve the errors on the project, this will do the trick until then.
`composer require hansschouten/laravel-pagebuilder //ok php artisan vendor:publish --provider="HansSchouten\LaravelPageBuilder\ServiceProvider" --tag=config //ok php artisan migrate
PDOException
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pb.pagebuilder__settings' doesn't exist
at D:\www\pb\vendor\hansschouten\phpagebuilder\src\Core\DB.php:65 61▕ $stmt = $this->pdo->prepare("SELECT {$columns} FROM {$table}"); 62▕ } else { 63▕ $stmt = $this->pdo->prepare("SELECT * FROM {$table}"); 66▕ return $stmt->fetchAll(); 67▕ } 68▕ 69▕ /**
1 D:\www\pb\vendor\hansschouten\phpagebuilder\src\Core\DB.php:65 PDOStatement::execute()
2 D:\www\pb\vendor\hansschouten\phpagebuilder\src\Repositories\BaseRepository.php:156 PHPageBuilder\Core\DB::all("pagebuilder__settings", "*")`