1

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

Huzaifa
  • 345
  • 4
  • 15
  • What if run -> composer dump-autoload <- and then -> composer update <- – Lucas Rueda Feb 05 '20 at 19:59
  • already tried this that gives the same error but with additional response ----Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1---- – Huzaifa Feb 05 '20 at 20:07

2 Answers2

0

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...
Waleed Muaz
  • 737
  • 6
  • 17
0

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
Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
  • i already tried this solution,this gives me the same error but with the additional message ''> Illuminate\Foundation\ComposerScripts::postAutoloadDump Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1 – Huzaifa Feb 06 '20 at 05:40