/** * Invitation Token * Get related models. * * @param string $token */ public static function withinvitation($token) { # Return user and account return [User::whereHas('accounts', function ($q) use($token) { $q->where('account_user.invitation_token', $token); })->first(), Account::whereHas('users', function ($q) use($token) { $q->where('account_user.invitation_token', $token); })->first()]; }
public function run() { $user = new User(['email' => '*****@*****.**', 'firstname' => 'Zen', 'lastname' => 'Bot']); $user->setPassword('secret'); Account::first()->users()->save($user); }
public function run() { $client = new Oauth2Client(); $client->setClientId()->setClientSecret()->setName('Project app')->setRedirectUri('http://localhost/projectapp/auth.html'); User::first()->oauth2clients()->save($client); }