trypost/app/Models/WorkspaceLabel.php
Paulo Castellano c0886737c4 feat: add labels and hashtags to posts
- Add many-to-many relationship between posts and workspace labels
- Add label selector in post edit page with autosave
- Display labels in posts list
- Add hashtags modal with search for appending hashtags to post content
- Fix sidebar active state for posts edit page
- Fix AvatarImage null src warning in SocialAccountsGrid
- Fix new post state by using Inertia::location for full page reload
- Hide close button on CommandDialog by default
2026-01-26 15:18:35 -03:00

32 lines
794 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class WorkspaceLabel extends Model
{
/** @use HasFactory<\Database\Factories\WorkspaceLabelFactory> */
use HasFactory, HasUuids, SoftDeletes;
protected $fillable = [
'workspace_id',
'name',
'color',
];
public function workspace(): BelongsTo
{
return $this->belongsTo(Workspace::class);
}
public function posts(): BelongsToMany
{
return $this->belongsToMany(Post::class);
}
}