57 lines
1.5 KiB
PHP
Executable File
57 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
#[Fillable(['name', 'email', 'password', 'role', 'is_approved', 'avatar'])]
|
|
#[Hidden(['password', 'remember_token'])]
|
|
class User extends Authenticatable
|
|
{
|
|
/** @use HasFactory<\Database\Factories\UserFactory> */
|
|
use HasFactory, Notifiable;
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
'is_approved' => 'boolean',
|
|
'role' => 'string',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get all of the prompt projects for the user.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\PromptProject>
|
|
*/
|
|
public function projects(): HasMany
|
|
{
|
|
return $this->hasMany(PromptProject::class);
|
|
}
|
|
|
|
/**
|
|
* Get all of the prompt generations for the user.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\PromptGeneration>
|
|
*/
|
|
public function generations(): HasMany
|
|
{
|
|
return $this->hasMany(PromptGeneration::class);
|
|
}
|
|
}
|