mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-05-07 20:32:26 +00:00
66 lines
1.5 KiB
PHP
66 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\ProjectFactory;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
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\HasMany;
|
|
|
|
/**
|
|
* @property string $id
|
|
* @property string $name
|
|
* @property string $color
|
|
* @property string $organization_id
|
|
* @property string $client_id
|
|
* @property-read Organization $organization
|
|
* @property-read Client|null $client
|
|
* @property-read Collection<Task> $tasks
|
|
*
|
|
* @method static ProjectFactory factory()
|
|
*/
|
|
class Project extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasUuids;
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array<string, string>
|
|
*/
|
|
protected $casts = [
|
|
'name' => 'string',
|
|
'color' => 'string',
|
|
];
|
|
|
|
/**
|
|
* @return BelongsTo<Organization, Project>
|
|
*/
|
|
public function organization(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Organization::class, 'organization_id');
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<Client, Project>
|
|
*/
|
|
public function client(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Client::class, 'client_id');
|
|
}
|
|
|
|
/**
|
|
* @return HasMany<Task>
|
|
*/
|
|
public function tasks(): HasMany
|
|
{
|
|
return $this->hasMany(Task::class);
|
|
}
|
|
}
|