12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace App;
- use App\Notifications\Email\ResetPassword as ResetPasswordNotification;
- use App\Notifications\Email\VerifyEmail as VerifyEmailNotification;
- use Illuminate\Contracts\Auth\MustVerifyEmail;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Illuminate\Notifications\Notifiable;
- use Laratrust\Traits\LaratrustUserTrait;
- class User extends Authenticatable implements MustVerifyEmail
- {
- use Notifiable, SoftDeletes, LaratrustUserTrait;
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $fillable = [
- 'name', 'username', 'parent_id', 'is_superuser', 'is_banned', 'two_factor_status', 'mobile', 'email', 'password'
- ];
- /**
- * The attributes that should be hidden for arrays.
- *
- * @var array
- */
- protected $hidden = [
- 'password', 'remember_token',
- ];
- /**
- * The attributes that should be cast to native types.
- *
- * @var array
- */
- protected $casts = [
- 'email_verified_at' => 'datetime',
- ];
- /**
- * @return mixed
- */
- public function isSuperUser()
- {
- return $this->is_supperuser;
- }
- /**
- * @return mixed
- */
- public function isBanned()
- {
- return $this->is_banned;
- }
- /**
- * Send the password reset notification.
- *
- * @param string $token
- * @return void
- */
- public function sendPasswordResetNotification($token)
- {
- $this->notify(new ResetPasswordNotification($token));
- }
- /**
- * Send the email verification notification.
- *
- * @return void
- */
- public function sendEmailVerificationNotification()
- {
- $this->notify(new VerifyEmailNotification);
- }
- public function product()
- {
- return $this->hasMany(Product::class,'creator_id', 'id');
- }
- public function category()
- {
- return $this->hasMany(Category::class,'creator_id', 'id');
- }
- }
|