view.stub 769 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class Create[ViewName:Studly]View extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. DB::statement($this->dropView());
  15. DB::statement($this->createView());
  16. }
  17. /**
  18. * Reverse the migrations.
  19. *
  20. * @return void
  21. */
  22. public function down()
  23. {
  24. DB::statement($this->dropView());
  25. }
  26. private function createView()
  27. {
  28. return <<<SQL
  29. [Schema]
  30. SQL;
  31. }
  32. private function dropView()
  33. {
  34. return <<<SQL
  35. DROP VIEW IF EXISTS `[ViewName]`;
  36. SQL;
  37. }
  38. }