Initial commit

This commit is contained in:
omair saleh
2020-10-16 10:12:19 +08:00
commit 27e62640ca
275 changed files with 29752 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\MustVerifyEmail;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends AbstractModel implements
JWTSubject,
AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail;
/**
* Get the identifier that will be stored in the subject claim of the JWT.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
public function emailVerification(): HasMany {
return $this->hasMany(UserEmailVerification::class, 'email', 'email');
}
/**
* @return HasMany
*/
public function passwordReset(): HasMany {
return $this->hasMany(PasswordReset::class, 'user_id', 'id');
}
public function employers(): belongsToMany {
return $this->belongsToMany(CompanyModule::class, (new CompanyEmployee())->getTable(), 'user_id', 'module_id');
}
public function tweets(): hasMany {
return $this->hasMany(Order::class, 'user_id', 'id');
}
}