Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Console\Commands;
- use App\Club;
- use App\Role;
- use App\Squad;
- use App\User;
- use Carbon\Carbon;
- use Illuminate\Console\Command;
- class MakeDemoSite extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'make:demo';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'Creates a demo site';
- /**
- * EditPlayerReviews constructor.
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $club = new Club();
- $club->sport_id = 1;
- $club->username = 'demo';
- $club->name = 'demo';
- $club->colour = '#2d2f5d';
- $club->settings = [];
- $club->save();
- $user = new User();
- $user->club_id = $club->id;
- $user->name = 'Richard Kelly';
- $user->username = 'richardkelly';
- $user->password = bcrypt('password');
- $user->dob = Carbon::yesterday();
- $user->save();
- $role = new Role();
- $role->club_id = $club->id;
- $role->name = 'Super-Admin';
- $user->roles()->save($role);
- $squad = new Squad();
- $squad->club_id = $club->id;
- $squad->name = 'First Team';
- $squad->save();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement