You've already forked Atomcms-edit
43 lines
1.0 KiB
PHP
Executable File
43 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models\Community\Staff;
|
|
|
|
use App\Models\User;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property string $description
|
|
* @property string|null $badge
|
|
* @property string $color
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
* @property-read Collection<int, User> $users
|
|
*
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|WebsiteTeam where($column, $operator = null, $value = null)
|
|
*/
|
|
class WebsiteTeam extends Model
|
|
{
|
|
#[\Override]
|
|
protected $guarded = ['id', 'created_at', 'updated_at'];
|
|
|
|
public function users(): HasMany
|
|
{
|
|
return $this->hasMany(User::class, 'team_id', 'id');
|
|
}
|
|
|
|
public function getBadgePath(): string
|
|
{
|
|
return sprintf('%s%s.gif', setting('badges_path'), $this->getBadgeName());
|
|
}
|
|
|
|
public function getBadgeName(): string
|
|
{
|
|
return $this->badge ?: '';
|
|
}
|
|
}
|