Files
jobifygarden/app/Models/User.php
T

58 lines
1.4 KiB
PHP
Raw Normal View History

2026-04-02 23:00:12 +03:00
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Factories\HasFactory;
2026-04-03 00:23:01 +03:00
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
2026-04-02 23:00:12 +03:00
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
#[Fillable(['name', 'email', 'password'])]
#[Hidden(['password', 'remember_token'])]
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
2026-05-01 23:33:15 +03:00
protected $fillable = [
'name',
'email',
'password',
];
2026-04-02 23:00:12 +03:00
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
2026-04-03 00:23:01 +03:00
/**
* Get the jobs saved by this user.
*/
public function savedJobs(): BelongsToMany
{
return $this->belongsToMany(Job::class, 'user_saved_jobs')
->withTimestamps();
}
/**
* Get the job alerts for this user.
*/
public function jobAlerts(): HasMany
{
return $this->hasMany(UserJobAlert::class);
}
2026-04-02 23:00:12 +03:00
}