Created
September 13, 2019 14:50
-
-
Save MCKLtech/e9696aa54cb71bbb923347acc75bcc85 to your computer and use it in GitHub Desktop.
This gist demonstrates a method of adding a Spark User to an existing Spark 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\Contracts\Interactions\Settings\Teams\AddTeamMember; | |
//Get a Spark User | |
$sparkUser = Spark::user()->where('email', '[email protected]')->first(); | |
//TODO: Check user exists | |
//Get a Spark Team | |
$team = Team::where('name', 'myGreatTeam')->first(); | |
//TODO: Check Team exists | |
//The role 'member' is a default in Spark. | |
Spark::interact(AddTeamMember::class, [ | |
$team, $sparkUser, 'member' | |
]); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment