2024-06-18 00:41:12 -04:00
|
|
|
<?php
|
|
|
|
|
2025-01-30 00:23:55 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2024-06-18 00:41:12 -04:00
|
|
|
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;
|
2024-06-18 00:41:12 -04:00
|
|
|
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
|
|
|
|
*/
|
2024-06-18 00:41:12 -04:00
|
|
|
class UserRole extends Model
|
|
|
|
{
|
2025-01-30 20:49:56 -05:00
|
|
|
/** @use HasFactory<UserRoleFactory> */
|
2024-06-18 00:41:12 -04:00
|
|
|
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
|
|
|
*/
|
2024-06-18 00:41:12 -04:00
|
|
|
public function users(): HasMany
|
|
|
|
{
|
2024-09-11 15:09:27 -04:00
|
|
|
return $this->hasMany(User::class)
|
|
|
|
->chaperone();
|
2024-06-18 00:41:12 -04:00
|
|
|
}
|
|
|
|
}
|