Completed
Pull Request — master (#259)
by Cristian
05:31
created

BackpackUser::sendPasswordResetNotification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Backpack\Base\app\Models;
4
5
use App\User;
6
use Backpack\Base\app\Notifications\ResetPasswordNotification as ResetPasswordNotification;
7
8
class BackpackUser extends User
9
{
10
    protected $table = 'users';
11
12
    /**
13
     * Send the password reset notification.
14
     *
15
     * @param string $token
16
     *
17
     * @return void
18
     */
19
    public function sendPasswordResetNotification($token)
20
    {
21
        $this->notify(new ResetPasswordNotification($token));
22
    }
23
24
    /**
25
     * Build the mail representation of the notification.
26
     *
27
     * @return \Illuminate\Notifications\Messages\MailMessage
28
     */
29
    public function toMail($notifiable)
30
    {
31
        return (new MailMessage())
32
            ->line([
33
                trans('backpack.base.password_reset.line_1'),
34
                trans('backpack.base.password_reset.line_2'),
35
            ])
36
            ->action(trans('backpack.base.password_reset.button'), url(config('backpack.base.route_prefix').'/password/reset', $this->token))
37
            ->line(trans('backpack.base.password_reset.notice'));
38
    }
39
}
40