Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
6 / 6 |
| User | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
6 / 6 |
| sendPasswordResetNotification | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| sendPasswordResetNotificationWithConfig | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| sites | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| serializeDate | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Qmp\Laravel\ExternalUsers\Models; |
| 4 | |
| 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | use Illuminate\Notifications\Notifiable; |
| 7 | use Illuminate\Foundation\Auth\User as Authenticatable; |
| 8 | |
| 9 | use Qmp\Laravel\ExternalUsers\Notifications\ResetPassword as ResetPasswordNotification; |
| 10 | |
| 11 | class User extends Authenticatable |
| 12 | { |
| 13 | use Notifiable; |
| 14 | |
| 15 | public function sendPasswordResetNotification($token) |
| 16 | { |
| 17 | $this->notify(new ResetPasswordNotification($token, $this->email)); |
| 18 | } |
| 19 | |
| 20 | public function sendPasswordResetNotificationWithConfig($token, array $config = []) |
| 21 | { |
| 22 | $this->notify(new ResetPasswordNotification($token, $this->email, $config)); |
| 23 | } |
| 24 | |
| 25 | protected $connection = 'externalUsers'; |
| 26 | protected $table = 'users'; |
| 27 | |
| 28 | protected $fillable = ['name', 'email', 'password', 'type']; |
| 29 | |
| 30 | protected $hidden = [ |
| 31 | 'password', 'remember_token', |
| 32 | ]; |
| 33 | |
| 34 | protected $casts = [ |
| 35 | 'email_verified_at' => 'datetime', |
| 36 | ]; |
| 37 | |
| 38 | //protected $with = ['sites']; |
| 39 | |
| 40 | const TYPE_ADVERTISER = 'advertiser'; |
| 41 | const TYPE_PUBLISHER = 'publisher'; |
| 42 | |
| 43 | |
| 44 | public function sites() |
| 45 | { |
| 46 | return $this->belongsToMany(Site::class)->withTimestamps(); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Prepare a date for array / JSON serialization. |
| 51 | * |
| 52 | * @param \DateTimeInterface $date |
| 53 | * @return string |
| 54 | */ |
| 55 | protected function serializeDate(\DateTimeInterface $date) |
| 56 | { |
| 57 | return $date->format('Y-m-d H:i:s'); |
| 58 | } |
| 59 | |
| 60 | |
| 61 | } |