First Commit
This commit is contained in:
Executable
+145
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $email
|
||||
* @property \Illuminate\Support\Carbon|null $email_verified_at
|
||||
* @property string $password
|
||||
* @property string|null $remember_token
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property string|null $phone
|
||||
* @property string $locale
|
||||
* @property bool $is_active
|
||||
* @property bool $is_approved
|
||||
* @property-read Collection<int, UserSubject> $userSubjects
|
||||
* @property-read Collection<int, Insight> $insights
|
||||
* @property-read Collection<int, InsightSchedule> $insightSchedules
|
||||
* @property-read Collection<int, TelegramUser> $telegramUsers
|
||||
* @property-read Collection<int, TokenUsage> $tokenUsages
|
||||
* @property-read Collection<int, Subject> $subjects
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable, HasRoles;
|
||||
|
||||
/** @var array<int, string> */
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'phone',
|
||||
'locale',
|
||||
'timezone',
|
||||
'is_active',
|
||||
'is_approved',
|
||||
'token_limit',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'is_active' => 'boolean',
|
||||
'is_approved' => 'boolean',
|
||||
'token_limit' => 'integer',
|
||||
];
|
||||
|
||||
/** @var array<int, string> */
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the user subjects for the user.
|
||||
*/
|
||||
public function userSubjects(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserSubject::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user interests for the user.
|
||||
*/
|
||||
public function userInterests(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserInterest::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the insights for the user.
|
||||
*/
|
||||
public function insights(): HasMany
|
||||
{
|
||||
return $this->hasMany(Insight::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the insight schedules for the user.
|
||||
*/
|
||||
public function insightSchedules(): HasMany
|
||||
{
|
||||
return $this->hasMany(InsightSchedule::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the telegram users for the user.
|
||||
*/
|
||||
public function telegramUsers(): HasMany
|
||||
{
|
||||
return $this->hasMany(TelegramUser::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the token usages for the user.
|
||||
*/
|
||||
public function tokenUsages(): HasMany
|
||||
{
|
||||
return $this->hasMany(TokenUsage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subjects created by the user.
|
||||
*/
|
||||
public function subjects(): HasMany
|
||||
{
|
||||
return $this->hasMany(Subject::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user consents.
|
||||
*/
|
||||
public function consents(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserConsent::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user subscriptions.
|
||||
*/
|
||||
public function subscriptions(): HasMany
|
||||
{
|
||||
return $this->hasMany(\App\Models\UserSubscription::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user notifications.
|
||||
*/
|
||||
public function notifications(): HasMany
|
||||
{
|
||||
return $this->hasMany(\App\Models\UserNotification::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user