You've already forked Atomcms-edit
Initial commit
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
<?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 ?: '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user