PHP Класс RainLab\User\Models\MailBlocker

A utility model that allows a user to block specific mail views/templates from being sent to their address.
Наследование: extends Mode\Model
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$belongsTo Relations
$table The database table used by the model.

Защищенные свойства (Protected)

Свойство Тип Описание
$guarded Guarded fields
$safeTemplates Templates names that cannot be blocked.

Открытые методы

Метод Описание
addBlock ( string $template, RainLab\User\Models\User $user ) : boolean Adds a block for a user and a mail view/template code.
blockAll ( RainLab\User\Models\User $user ) : boolean Blocks all mail messages for a user.
checkAllForUser ( Model $user ) : array Returns a list of mail templates blocked by the user.
checkForEmail ( string $template, string $email ) : array Checks if an email address has blocked a given template, returns an array of blocked emails.
filterMessage ( string $template, Illuminate\Mail\Message $message ) : boolean | null Filters a Illuminate\Mail\Message and removes blocked recipients.
isBlockAll ( RainLab\User\Models\User $user ) : boolean Checks if a user is blocking all templates.
removeBlock ( string $template, RainLab\User\Models\User $user ) : boolean Removes a block for a user and a mail view/template code.
setPreferences ( RainLab\User\Models\User $user, array $templates, array $options = [] ) : void Sets mail blocking preferences for a user. Eg:
syncUser ( Model $user ) : mixed Updates mail blockers for a user if they change their email address
unblockAll ( RainLab\User\Models\User $user ) : boolean Removes block on all mail messages for a user.

Описание методов

addBlock() публичный статический Метод

Adds a block for a user and a mail view/template code.
public static addBlock ( string $template, RainLab\User\Models\User $user ) : boolean
$template string
$user RainLab\User\Models\User
Результат boolean

blockAll() публичный статический Метод

Blocks all mail messages for a user.
public static blockAll ( RainLab\User\Models\User $user ) : boolean
$user RainLab\User\Models\User
Результат boolean

checkAllForUser() публичный статический Метод

Returns a list of mail templates blocked by the user.
public static checkAllForUser ( Model $user ) : array
$user Model
Результат array

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
$template string
$email string
Результат array

filterMessage() публичный статический Метод

If no recipients remain, false is returned. Returns null if mailing should proceed.
public static filterMessage ( string $template, Illuminate\Mail\Message $message ) : boolean | null
$template string
$message Illuminate\Mail\Message
Результат boolean | null

isBlockAll() публичный статический Метод

Checks if a user is blocking all templates.
public static isBlockAll ( RainLab\User\Models\User $user ) : boolean
$user RainLab\User\Models\User
Результат boolean

removeBlock() публичный статический Метод

Removes a block for a user and a mail view/template code.
public static removeBlock ( string $template, RainLab\User\Models\User $user ) : boolean
$template string
$user RainLab\User\Models\User
Результат boolean

setPreferences() публичный статический Метод

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.
public static setPreferences ( RainLab\User\Models\User $user, array $templates, array $options = [] ) : void
$user RainLab\User\Models\User
$templates array Template name as key and boolean as value. If false, template is blocked.
$options array
Результат void

syncUser() публичный статический Метод

Updates mail blockers for a user if they change their email address
public static syncUser ( Model $user ) : mixed
$user Model
Результат mixed

unblockAll() публичный статический Метод

Removes block on all mail messages for a user.
public static unblockAll ( RainLab\User\Models\User $user ) : boolean
$user RainLab\User\Models\User
Результат boolean

Описание свойств

$belongsTo публичное свойство

Relations
public $belongsTo

$guarded защищенное свойство

Guarded fields
protected $guarded

$safeTemplates защищенное статическое свойство

Templates names that cannot be blocked.
protected static $safeTemplates

$table публичное свойство

The database table used by the model.
public $table