Created
September 13, 2019 14:52
-
-
Save MCKLtech/33531725ed066dae32bbc1b0733d4d1d to your computer and use it in GitHub Desktop.
This gist demonstrates a method of creating a Spark User and setting up their initial Team
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use App\Team; | |
use Laravel\Spark\Spark; | |
use Laravel\Spark\Interactions\Settings\Teams\CreateTeam; | |
//Create a User | |
$sparkUser = Spark::user(); | |
$sparkUser->forceFill([ | |
'name' => 'Joe Bloggs', | |
'email' => '[email protected]', | |
'password' => bcrypt('superPassword'), | |
'email_verified_at' => Carbon::now(), | |
'last_read_announcements_at' => Carbon::now(), | |
'trial_ends_at' => Spark::onlyTeamPlans() ? null : Carbon::now()->addDays(Spark::trialDays()) | |
])->save(); | |
//Create a Team | |
Spark::interact(CreateTeam::class, [ | |
$sparkUser, [ | |
'name' => 'My Team Name', | |
'slug' => 'my-slug', | |
] | |
]); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment