Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Console\Commands;
  4.  
  5. use App\Club;
  6. use App\Role;
  7. use App\Squad;
  8. use App\User;
  9. use Carbon\Carbon;
  10. use Illuminate\Console\Command;
  11.  
  12. class MakeDemoSite extends Command
  13. {
  14. /**
  15. * The name and signature of the console command.
  16. *
  17. * @var string
  18. */
  19. protected $signature = 'make:demo';
  20.  
  21. /**
  22. * The console command description.
  23. *
  24. * @var string
  25. */
  26. protected $description = 'Creates a demo site';
  27.  
  28. /**
  29. * EditPlayerReviews constructor.
  30. */
  31. public function __construct()
  32. {
  33. parent::__construct();
  34.  
  35. }
  36.  
  37. /**
  38. * Execute the console command.
  39. *
  40. * @return mixed
  41. */
  42. public function handle()
  43. {
  44. $club = new Club();
  45. $club->sport_id = 1;
  46. $club->username = 'demo';
  47. $club->name = 'demo';
  48. $club->colour = '#2d2f5d';
  49. $club->settings = [];
  50. $club->save();
  51.  
  52. $user = new User();
  53. $user->club_id = $club->id;
  54. $user->name = 'Richard Kelly';
  55. $user->username = 'richardkelly';
  56. $user->password = bcrypt('password');
  57. $user->dob = Carbon::yesterday();
  58. $user->save();
  59.  
  60. $role = new Role();
  61. $role->club_id = $club->id;
  62. $role->name = 'Super-Admin';
  63. $user->roles()->save($role);
  64.  
  65. $squad = new Squad();
  66. $squad->club_id = $club->id;
  67. $squad->name = 'First Team';
  68. $squad->save();
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement