fix: fix relations and casts in admin and user models

This commit is contained in:
2026-08-17 08:14:24 +03:30
parent ed02b45269
commit 1c7623be8f
2 changed files with 29 additions and 24 deletions
+25 -20
View File
@@ -7,14 +7,18 @@
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
//use Illuminate\Foundation\Auth\Admin as Authenticate;
//use Illuminate\Foundation\Auth\Admin as Authenticate;
/**
* Class Admin
*
*
* @property int $id
* @property string $first_name
* @property string $last_name
* @property string $full_name
* @property string $username
* @property string $email
* @property string $mobile
* @property string $password
@@ -24,25 +28,26 @@ use Illuminate\Database\Eloquent\Model;
*
* @package App\Models
*/
class Admin extends Model
class Admin extends User
{
protected $table = 'admins';
public static $snakeAttributes = false;
protected $table = 'admins';
protected $casts = [
'status' => 'int'
];
public static $snakeAttributes = false;
protected $hidden = [
'password'
];
protected $casts = [
'status' => 'int',
];
protected $fillable = [
'first_name',
'last_name',
'email',
'mobile',
'password',
'status'
];
protected $hidden = [
'password',
];
protected $fillable = [
'full_name',
'username',
'email',
'mobile',
'password',
'status',
];
}
+4 -4
View File
@@ -8,11 +8,11 @@ namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticate;
/**
* Class User
*
*
* @property int $id
* @property string $first_name
* @property string $last_name
@@ -24,13 +24,13 @@ use Illuminate\Database\Eloquent\Model;
* @property int $status
* @property Carbon $created_at
* @property Carbon $updated_at
*
*
* @property Collection|Comment[] $comments
* @property Collection|Favorite[] $favorites
*
* @package App\Models
*/
class User extends Model
class User extends Authenticate
{
protected $table = 'users';
public static $snakeAttributes = false;