Clear.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace App\Console\Commands\Seeder;
  3. use App\Models\Article;
  4. use App\Models\ArticleTag;
  5. use App\Models\Category;
  6. use App\Models\Chat;
  7. use App\Models\Comment;
  8. use App\Models\Config;
  9. use App\Models\FriendshipLink;
  10. use App\Models\GitProject;
  11. use App\Models\OauthUser;
  12. use App\Models\Tag;
  13. use Illuminate\Console\Command;
  14. class Clear extends Command
  15. {
  16. /**
  17. * The name and signature of the console command.
  18. *
  19. * @var string
  20. */
  21. protected $signature = 'seeder:clear';
  22. /**
  23. * The console command description.
  24. *
  25. * @var string
  26. */
  27. protected $description = 'Clear seeder data';
  28. /**
  29. * Create a new command instance.
  30. *
  31. * @return void
  32. */
  33. public function __construct()
  34. {
  35. parent::__construct();
  36. }
  37. /**
  38. * Execute the console command.
  39. *
  40. * @return mixed
  41. */
  42. public function handle()
  43. {
  44. ArticleTag::truncate();
  45. Article::truncate();
  46. Category::truncate();
  47. Chat::truncate();
  48. Comment::truncate();
  49. OauthUser::truncate();
  50. Tag::truncate();
  51. GitProject::truncate();
  52. FriendshipLink::truncate();
  53. $this->info('successfully');
  54. }
  55. }