TemplatesLinkCommand.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace App\Console;
  3. use Illuminate\Console\Command;
  4. class TemplatesLinkCommand extends Command
  5. {
  6. /**
  7. * The console command signature.
  8. *
  9. * @var string
  10. */
  11. protected $signature = 'templates:link';
  12. /**
  13. * The console command description.
  14. *
  15. * @var string
  16. */
  17. protected $description = 'Create a symbolic link from "templates" path to "public/templates"';
  18. /**
  19. * Execute the console command.
  20. *
  21. * @return void
  22. */
  23. public function handle()
  24. {
  25. if (!file_exists(public_path('templates'))) {
  26. $this->laravel->make('files')->link(
  27. base_path('templates'), public_path('templates')
  28. );
  29. }
  30. if (!file_exists(public_path('select2'))) {
  31. $this->laravel->make('files')->link(
  32. base_path('select2'), public_path('select2')
  33. );
  34. }
  35. if (!file_exists(public_path('validation'))) {
  36. $this->laravel->make('files')->link(
  37. base_path('validation'), public_path('validation')
  38. );
  39. }
  40. if (!file_exists(public_path('css'))) {
  41. $this->laravel->make('files')->link(
  42. base_path('css'), public_path('css')
  43. );
  44. }
  45. if (!file_exists(public_path('images'))) {
  46. $this->laravel->make('files')->link(
  47. base_path('images'), public_path('images')
  48. );
  49. }
  50. $this->info('The [public/templates] directory has been linked.');
  51. }
  52. }