MailBlocker
extends Model
in package
RainLab\User\Models\MailBlocker
Tags
Table of Contents
- $belongsTo : array<string|int, mixed>
- $created_at : Carbon|null
- $email : string|null
- $id : int
- $table : string
- $template : string|null
- $updated_at : Carbon|null
- $user_id : int|null
- $guarded : array<string|int, mixed>
- $safeTemplates : array<string|int, mixed>
- addBlock() : bool
- Adds a block for a user and a mail view/template code.
- all() :
- blockAll() : bool
- Blocks all mail messages for a user.
- checkAllForUser() : array<string|int, mixed>
- Returns a list of mail templates blocked by the user.
- checkForEmail() : array<string|int, mixed>
- Checks if an email address has blocked a given template, returns an array of blocked emails.
- filterMessage() : bool|null
- Filters a Illuminate\Mail\Message and removes blocked recipients.
- get() :
- isBlockAll() : bool
- Checks if a user is blocking all templates.
- newModelQuery() :
- newQuery() :
- query() :
- removeBlock() : bool
- Removes a block for a user and a mail view/template code.
- setPreferences() : void
- Sets mail blocking preferences for a user. Eg:
- syncUser() : mixed
- Updates mail blockers for a user if they change their email address
- unblockAll() : bool
- Removes block on all mail messages for a user.
- whereCreatedAt() :
- whereEmail() :
- whereId() :
- whereTemplate() :
- whereUpdatedAt() :
- whereUserId() :
Properties
$belongsTo
public
array<string|int, mixed>
$belongsTo
= ['user' => RainLabUserModelsUser::class]
Relations
$created_at
public
Carbon|null
$created_at
public
string|null
$email
$id
public
int
$id
$table
public
string
$table
= 'rainlab_user_mail_blockers'
The database table used by the model.
$template
public
string|null
$template
$updated_at
public
Carbon|null
$updated_at
$user_id
public
int|null
$user_id
$guarded
protected
array<string|int, mixed>
$guarded
= []
Guarded fields
$safeTemplates
protected
static array<string|int, mixed>
$safeTemplates
= ['rainlab.user::mail.restore']
Templates names that cannot be blocked.
Methods
addBlock()
Adds a block for a user and a mail view/template code.
public
static addBlock(string $template, User $user) : bool
Parameters
- $template : string
- $user : User
Return values
bool —all()
public
static all(mixed $columns) :
Parameters
- $columns : mixed
Return values
—blockAll()
Blocks all mail messages for a user.
public
static blockAll(User $user) : bool
Parameters
- $user : User
Return values
bool —checkAllForUser()
Returns a list of mail templates blocked by the user.
public
static checkAllForUser(Model $user) : array<string|int, mixed>
Parameters
- $user : Model
Return values
array<string|int, mixed> —checkForEmail()
Checks if an email address has blocked a given template, returns an array of blocked emails.
public
static checkForEmail(string $template, string $email) : array<string|int, mixed>
Parameters
- $template : string
- $email : string
Return values
array<string|int, mixed> —filterMessage()
Filters a Illuminate\Mail\Message and removes blocked recipients.
public
static filterMessage(string $template, Message $message) : bool|null
If no recipients remain, false is returned. Returns null if mailing should proceed.
Parameters
- $template : string
- $message : Message
Return values
bool|null —get()
public
static get(mixed $columns) :
Parameters
- $columns : mixed
Return values
—isBlockAll()
Checks if a user is blocking all templates.
public
static isBlockAll(User $user) : bool
Parameters
- $user : User
Return values
bool —newModelQuery()
public
static newModelQuery() :
Return values
—newQuery()
public
static newQuery() :
Return values
—query()
public
static query() :
Return values
—removeBlock()
Removes a block for a user and a mail view/template code.
public
static removeBlock(string $template, User $user) : bool
Parameters
- $template : string
- $user : User
Return values
bool —setPreferences()
Sets mail blocking preferences for a user. Eg:
public
static setPreferences(User $user, array<string|int, mixed> $templates[, array<string|int, mixed> $options = [] ]) : void
MailBlocker::setPreferences($user, [acme.blog::post.new_reply => 0])
MailBlocker::setPreferences($user, [acme.blog::post.new_reply => 0], [fillable => [acme.blog::post.new_reply]])
MailBlocker::setPreferences($user, [template_alias => 0], [aliases => [template_alias => acme.blog::post.new_reply]])
Supported options:
- aliases: Alias definitions, with alias as key and template as value.
- fillable: An array of expected templates, undefined templates are ignored.
- verify: Only allow mail templates that are registered in the system.
Parameters
- $user : User
- $templates : array<string|int, mixed>
-
Template name as key and boolean as value. If false, template is blocked.
- $options : array<string|int, mixed> = []
Return values
void —syncUser()
Updates mail blockers for a user if they change their email address
public
static syncUser(Model $user) : mixed
Parameters
- $user : Model
Return values
mixed —unblockAll()
Removes block on all mail messages for a user.
public
static unblockAll(User $user) : bool
Parameters
- $user : User
Return values
bool —whereCreatedAt()
public
static whereCreatedAt(mixed $value) :
Parameters
- $value : mixed
Return values
—whereEmail()
public
static whereEmail(mixed $value) :
Parameters
- $value : mixed
Return values
—whereId()
public
static whereId(mixed $value) :
Parameters
- $value : mixed
Return values
—whereTemplate()
public
static whereTemplate(mixed $value) :
Parameters
- $value : mixed
Return values
—whereUpdatedAt()
public
static whereUpdatedAt(mixed $value) :
Parameters
- $value : mixed
Return values
—whereUserId()
public
static whereUserId(mixed $value) :
Parameters
- $value : mixed