Closed
Description
I'm using the new version of Attribute Cast
in the Laravel version: 8.77 but showed this error when logged in authorization with guard admin
- Laravel Version: 8.77.1
- PHP Version: 8.0
Error:
Model Admin:
<?php
namespace App\Models\Tenant;
use Illuminate\Database\Eloquent\Casts\Attribute;
class Admin extends Authenticatable
{
use Notifiable, HasRoles, SoftDeletes;
/**
* The authentication guard name.
*
* @var string
*/
public $guard = 'admin';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
/**
* Set the admin's Hash password.
*
* @return Attribute
*/
protected function password(): Attribute
{
return new Attribute(
set: fn($value) => Hash::make($value),
);
}
}