Skip to content

Programatically add new donor sans donation #6814

Discussion options

You must be logged in to vote

Yup you can use the Donor model to create a new one like this:

$donor = Give\Donors\Models\Donor::create([
    'name' => trim("$firstName $lastName"),
    'firstName' => $firstName,
    'lastName' => $lastName,
    'email' => $donorEmail,
    'userId' => $userId ?: null
]);

// once created, it is inserted into the database and you can access the ID and other properties.
$donor->id

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@craig02445
Comment options

@craig02445
Comment options

Answer selected by kjohnson
Comment options

You must be logged in to vote
1 reply
@craig02445
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants