Ich habe gerade angefangen, PHP und Laravel 7 ohne vorherige Erfahrung zu lernen. Ich denke, Artisan und ich haben einige Vertrauensprobleme und ich weiß nicht warum.
Ich habe den Seeding -Schritt erreicht und habe einen Fehler, den ich in einfacher Weise auf einfache Weise lösen kann. Im Folgenden sind die vorherigen Schritte aufgeführt, die ich vor diesem Problem vorgenommen habe.
at C:\wamp64\www\E-Commerce\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
• A table was not found: You might have forgotten to run your migrations. You can run your migrations using `php artisan migrate`.
https://laravel.com/docs/master/migrations#running-migrations
1 C:\wamp64\www\E-Commerce\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458
PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'e-commerce.product' doesn't exist")
2 C:\wamp64\www\E-Commerce\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458
PDO::prepare("insert into `product` (`name`, `type`, `price`, `description`) values (?, ?, ?, ?)")
Ich habe gerade angefangen, PHP und Laravel 7 ohne vorherige Erfahrung zu lernen. Ich denke, Artisan und ich haben einige Vertrauensprobleme und ich weiß nicht warum. :) Ich habe den Seeding -Schritt erreicht und habe einen Fehler, den ich in einfacher Weise auf einfache Weise lösen kann. Im Folgenden sind die vorherigen Schritte aufgeführt, die ich vor diesem [url=viewtopic.php?t=26065]Problem[/url] vorgenommen habe.[code]php artisan make:model Product -m -c -resource< /code> < /p>
Datenbank < /strong> < /p>
class CreateProductsTable extends Migration { public function up() { Schema::create('products', function (Blueprint $table) { $table->id(); $table->string('name', 100); $table->string('image')->nullable(); $table->string('type'); $table->decimal('price', 2); $table->text('description')->nullable(); $table->timestamps(); }); }
public function down() { Schema::dropIfExists('products'); } } < /code>
Modell < /strong> < /p>
class Product extends Model { protected $table = 'product'; protected $fillable = ['name', 'image', 'type', 'price', 'description']; } < /code>
Controller < /strong> < /p>
class ProductController extends Controller {
public function __construct() { $this->middleware('auth'); }
public function index() { $product = DB::table('products')->get(); } } < /code>
AppServiceProvider < /strong> < /p>
class AppServiceProvider extends ServiceProvider { public function register() { Schema::defaultStringLength(191); } } < /code>
Danach habe ich den productTableSeeder < /strong> < /p>
PHP Artisan Made: Seeder ProductTableSeder < /p> < /block-yeovertoiD "erstellt.class ProductTableSeeder extends Seeder { public function run() { Product::insert([ 'name' => 'iphone', 'type' => 'smart phone', 'price' => 1000.98, 'description' => 'Cillum sint dolore sint labori', ]);
Product::insert([ 'name' => 'Galaxy', 'type' => 'tablets', 'price' => 2000.50, 'description' => 'Cillum sint dolore sint labori', ]);
class DatabaseSeeder extends Seeder { public function run() { // $this->call(UserSeeder::class); $this->call(ProductTableSeeder::class); } } < /code>
Dann, Composer Dump-autoload < /code> < /p>
Schließlich nach dem Eingeben des Befehls aus dem Aussaat < /p>
php artisan migrate:fresh --seed < /code>
Ich erhalte immer wieder den folgenden Fehler.Dropped all tables successfully. Migration table created successfully. Migrating: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_000000_create_users_table (0.51 seconds) Migrating: 2019_08_19_000000_create_failed_jobs_table Migrated: 2019_08_19_000000_create_failed_jobs_table (0.12 seconds) Migrating: 2020_04_13_063011_create_products_table Migrated: 2020_04_13_063011_create_products_table (0.18 seconds) Seeding: ProductTableSeeder
Illuminate\Database\QueryException
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'e-commerce.product' doesn't exist (SQL: insert into `product` < /code>
(name[/code], Typ , Preis , Beschreibung ) Werte (iPhone, Smartphone, 1000.98, Cillum Sint Dolore Sint Labori))
[code] at C:\wamp64\www\E-Commerce\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671 667| // If an exception occurs when attempting to run a query, we'll format the error 668| // message to include the bindings with SQL, which will make this exception a 669| // lot more helpful to the developer instead of just the database's errors. 670| catch (Exception $e) { > 671| throw new QueryException( 672| $query, $this->prepareBindings($bindings), $e 673| ); 674| } 675|
• A table was not found: You might have forgotten to run your migrations. You can run your migrations using `php artisan migrate`. https://laravel.com/docs/master/migrations#running-migrations
1 C:\wamp64\www\E-Commerce\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458 PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'e-commerce.product' doesn't exist")
Ich arbeite an einem Kryptowährungsprojekt namens Nefeli (GitHub Repository), das ein Fork von Wownero ist, das selbst ein Fork von Monero ist >. Ich stoße auf ein Problem mit der Funktionalität des...
flask-migrate erkannte meine Spaltenänderungen und konnte die Migration erfolgreich erstellen und ausführen.def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with...
Ich habe genau das gleiche Problem wie diese Stackoverflow -Frage, aber keine der Lösungen, die für mich bereitgestellt wurden. wurde durch den Versagen des Laravel -Seasators gestolpert.
Ich versuche, die Pitching-Statistiken dieser URL zu extrahieren und dann den Datenrahmen in einer CSV-Datei zu speichern.
/ARI202204070.shtml
Mein aktueller Code ist unten (Python 3.9.7)
_URL =...
Ich habe eine Laravel 5.2 -App (Mylaravel) in Ubuntu 14.04 mit XAMPP für Linux 5.6.15 erstellt. sichtbar unter http: // localhost: 8000 . Ich kann mich anmelden/loggen usw.
ohne den Artisan serve...