forge/app/Models/UserRole.php

42 lines
924 B
PHP
Raw Normal View History

<?php
2025-01-30 00:23:55 -05:00
declare(strict_types=1);
namespace App\Models;
2025-01-30 15:44:05 -05:00
use Carbon\Carbon;
2025-01-30 20:49:56 -05:00
use Database\Factories\UserRoleFactory;
2025-01-30 15:44:05 -05:00
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
2025-01-30 15:44:05 -05:00
/**
* UserRole Model
*
* @property int $id
* @property string $name
* @property string $short_name
* @property string $description
* @property string $color_class
* @property Carbon $created_at
* @property Carbon $updated_at
* @property-read Collection<int, User> $users
*/
class UserRole extends Model
{
2025-01-30 20:49:56 -05:00
/** @use HasFactory<UserRoleFactory> */
use HasFactory;
2024-07-20 19:52:36 -04:00
/**
* The relationship between a user role and users.
2024-09-11 23:08:58 -04:00
*
2025-01-30 15:44:05 -05:00
* @return HasMany<User, $this>
2024-07-20 19:52:36 -04:00
*/
public function users(): HasMany
{
return $this->hasMany(User::class)
->chaperone();
}
}