User

Tung Pham (tungpham42) php Public Mar 03, 2026 03:44 PM
Share
<?php

namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

    protected $fillable = [
        'name',
        'email',
        'google_id',
        'is_pro',
        'is_admin',
        'avatar',
        'password'
    ];

    public function pastes()
    {
        return $this->hasMany(Paste::class);
    }

    /**
     * Check if the user is an administrator.
     */
    public function isAdmin(): bool
    {
        return $this->is_admin;
    }

    protected function casts(): array
    {
        return [
            'password' => 'hashed',
            'is_admin' => 'boolean'
        ];
    }
}