Files
PeePal/Backend/laravel9/app/Models/User.php
Sándor Máté Magony 2d71603962 Majdnem kész
2025-04-24 15:38:31 +02:00

57 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Tymon\JWTAuth\Contracts\JWTSubject;
class User extends Authenticatable implements JWTSubject
{
use HasApiTokens, HasFactory, Notifiable;
public function getJWTIdentifier()
{
return $this->getKey();
}
public function getJWTCustomClaims()
{
return [];
}
// Change to match your migration
protected $table = 'felhasznalok';
protected $fillable = [
'nev',
'email',
'felh_nev',
'jelszo',
'is_admin',
];
protected $hidden = [
'jelszo',
'remember_token'
];
protected $casts = [
'is_admin' => 'boolean',
'email_verified_at' => 'datetime',
];
// This method tells Laravel to use jelszo field for passwords
public function getAuthPassword()
{
return $this->jelszo;
}
// Fix this to use 'jelszo' instead of 'password'
public function setJelszoAttribute($value)
{
$this->attributes['jelszo'] = \Illuminate\Support\Facades\Hash::make($value);
}
}