Skip to content
Advertisement

Laravel Migration: “ERROR Class not found”

I’m new to Laravel, I’m building a small project with five tables: users, products, category, transactions, and a pivot table category_product. When I try to run the command Php artisan migrate I receive an error class “Transaction” not found

here are the tables.

User Table

enter image description here

Reset Password Table

enter image description here

Products Table

enter image description here

Categories Table

enter image description here

Transactions Table

enter image description here

Category_product Table

enter image description here

** The order of Migrations in the Migration Folder**

enter image description here

And here is the full error I received

enter image description here

Advertisement

Answer

laravel get the migration class name from migration file name, to solve this:

1- rename file 2020_11_06_transactions to 2020_11_06_create_transactions_table

2-composer dumpautoload

3-php artisan optimize:clear

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement