skip to Main Content

I am new to laravel .
Following tutorial videos on laracast,i made a new migration (cmd command) like following

php artisan make:migration delete_title_from_posts_table

which gave me the message

Created Migration: 2020_02_05_185721_delete_title_from_posts_table

after that no php artisian command is working in cmd.

Any command i run gives me the following error

In Container.php line 805:

  Target class [db] does not exist.


In Container.php line 803:

  Class db does not exist

what would be causing this?
my laravel app version=6.2 and php version=7.3.5 on Win10 64-bit.

similar questions i already viewed,not working for me

artisan-commands-not-working-after-composer-update

in-container-php-line-805-target-class-db-does-not-exist

2

Answers


  1. Since it’s a facade, add this to the top of the class to make it work:

    use DB;
    

    Or use full namespace:

    $tables = DB::table...
    
    Login or Signup to reply.
  2. run these commands steps by step:

    • composer dump-autoload clean up all compiled files and their paths
    • composer update --no-scripts Skips execution of scripts defined in composer.json
    • composer update update your project’s dependencies
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search